Is there a automatic repaint in QML?
-
Hello,
I have programmed some custom QML components in Qt and everytime another component overlays mine I need a repaint.
The problem is, that the other components don't need to know anything about the one which gets overlapped so I can not call update on that component.Is there a way to automate this? So that everytime something in the UI changes every component gets repainted? Or to look if it needs a repaint so we gain a little bit more performance.
-
Hi,
As long as QML knows about the bounding rectangle of your custom component (if it is QDeclarativeItem derived and has a width/height, then it should, otherwise if it is QGraphicsObject derived you may need to re-implement QGraphicsItem::boundingRect()), and it only paints within its bounding rectangle, then repaints should automatically occur for regular usage (i.e. whenever the view detects that it needs a repaint).
To force a full repaint every time anything is detected dirty, you can also try the QGraphicsView::FullViewportUpdate flag.
Regards,
Michael