Hi there,
Using Qt 5.8 QPainter graphics (only text, lines and ellipses) are drawn and saved to QImage (PNG) and QSvgGenerator (SVG) files.
The graphic is dynamic in size. Because of that the graphic is drawn in an QImage or SVG with maximum size.
But the QImage / SVG should fit exactly to the size of the graphic. How can this be done?
1. My thoughts were, there might be a Qt method that can detect the size of the bounding rectangle of the QPainter graphic in the QImage. So the graphic can be drawn again in an QImage with the size of the detected rectangle. So graphic and image fit exactly.
2. Or there might be a Qt function that is able to cut an QImage to the size of its graphic content automatically. Is there such?
But maybe I think more complicated as it is. What is the best solution for this problem?
Bookmarks