I'm trying to implement my own QGraphicsItems to display in a QGraphicsScene. One advantage of this is, that I can keep the positions and sizes of my business objects, without having to convert between them and the display coordinate system.
But: Unfortunately the sizes are small, like 0.5 (meters). This is not a problem with the QPolygons, but when I want to display text at half the size of the objects, below a point or pixel size of 0.5, nothing gets displayed.
I got around that somewhat by having the labels separately created in the scene as QSimpleTextItems and scaling them afterwards, but I don't want that kind of separation.
Am I missing something? Like a way to scale everything times 100 behind the scenes?
Update:
I now also tried scaling the QPainter object up, so that I can use more "normal" font sizes, but it seems this does not change the behaviour.
Scaling everything by 100 and then setting the font (point) size to 0.2 * 100, does also not show the labels.
I solved this problem by creating a QGraphicsTextItem object inside my custom QGraphicsItem object.
This text object I can scale down to whatever size I need and just call its paint() method in the paint method of my custom object.
This works pretty well, although I'm not yet sure, if, for example, clicking the text, automatically translates to a click on my custom object, or if they are two separate entities.
I guess it comes down to the bounding rectangle, though.
How small can the Text in a QGraphicsScene get?