Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
4.7.3
-
Windows, MacOs
-
aefda8ce30695c5383860eab709acca345d290dc
Description
Using QGraphicsTextItem in non-gui application will result Segmentation fault. This happens because the cursor width is set based on the application style and non-gui application does not have a style.
The following code reproduces the problem:
int main(int argc, char *argv[])
{
QApplication app(argc, argv, false);
QImage image(200, 200, QImage::Format_ARGB32);
QPainter painter(&image);
QGraphicsTextItem item;
item.setHtml("<b>Graphics</b> item");
QStyleOptionGraphicsItem opt;
opt.state = QStyle::State_None;
item.paint(&painter, &opt, 0);
painter.end();
image.save("test.png");
return 0;
}