Recently, I had a problem in my application (So I provided a mini example of the problem) that I faced when creating large-scale images, and when I looked at the output image, it was not fully drawn! I don't know why, so I created a mini-example of that.
#include <QGuiApplication>
#include <QPainter>
#include <QPixmap>
static QPixmap imageTest(int width, int height, QColor const &color) {
static constexpr auto VERTICAL_PADDING = 2;
QPixmap pixmap(width, height);
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
QPen pen(color);
double const widthF = 1.0;
pen.setWidthF(widthF);
painter.setPen(pen);
for (int i = 0; i < width; ++i) {
QPointF p1(i, 94.9445); // mini example assume fixed height
QPointF p2(i, 167.055); // mini example consider fixed height
painter.drawLine(p1, p2);
}
painter.end();
return pixmap;
}
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
auto image = imageTest(211'459, 262, Qt::GlobalColor::green);
image.save("testFile.png", "PNG");
app.quit();
return 0;
}
the result of image , is something like this:
I also tested that with other approaches, like drawLines and fillRect, but it didn't help me. What's the problem?
The only way you can use: Dividing the images into smaller parts and making multiple images... I just found out that it could be useful and used it. Thanks for the comments.