Understanding QQuickItem
-
Hey, I need to display a pixmap to qml via a
QQuickItemand after reading the documentation, I am still not entirely sure how it works.From what I get, the key methods are
geometryChangeandupdatePaintNode.updatePaintNodeseems to be called (only?) whenQQuickItem::updateis called and it is the function that does the actual updating of the visual item, is that correct?Also, when exactly is
geometryChangecalled? Does this simply happen every time when an QQuickObject's size, position, ... changes?Is the
QQuickItem::updatemethod ever called from Qt itself, or am I responsible to do this, in react togeometryChangebeing called?Thanks in advance.
-
Why not use
Imagepaired withQQuickImageProvider? That way you can quite easily pass any pixmap to QML and have it displayed there.@aran It is a pixmap that is generated from a book page that is supposed to be scrolled, zoomed, etc. so it needs the flexibility and the extra properties as well as implicit widths and more.
-
@aran It is a pixmap that is generated from a book page that is supposed to be scrolled, zoomed, etc. so it needs the flexibility and the extra properties as well as implicit widths and more.
@Creaperdown Do you have access to the full pixmap? You could load it on the qml side and implement the scrolling (e.g.,
Flickable) and zooming (scaleproperty) there. If that's no applicable to your use case, then I don't know, I have no experience with usingQQuickItemdirectly unfortunately... -
QQuickImageProvider is likely the easier route to follow.
ImageinheritsItem, which instantiates QQuickItem. I don't believe that any of the properties in QQuickItem are final. -
Hey, I need to display a pixmap to qml via a
QQuickItemand after reading the documentation, I am still not entirely sure how it works.From what I get, the key methods are
geometryChangeandupdatePaintNode.updatePaintNodeseems to be called (only?) whenQQuickItem::updateis called and it is the function that does the actual updating of the visual item, is that correct?Also, when exactly is
geometryChangecalled? Does this simply happen every time when an QQuickObject's size, position, ... changes?Is the
QQuickItem::updatemethod ever called from Qt itself, or am I responsible to do this, in react togeometryChangebeing called?Thanks in advance.
@Creaperdown are you mixing qwidget and qml?
-
@Creaperdown are you mixing qwidget and qml?
@JoeCFD No
-
QQuickImageProvider is likely the easier route to follow.
ImageinheritsItem, which instantiates QQuickItem. I don't believe that any of the properties in QQuickItem are final.@jeremy_k I am following an example of how Okular (the document viewer) is doing it, and they are using QQuickItem to generate and display items as well.