Hello all,
Recently I have tried adding [QGraphicsItem/QWidget]s to a Qt Quick carousel/cover flow animation ( QML's PathView ). What I have done to add custom widget/graphics item to the path view's list of items was to use the QWidget (which was converted to QGraphicsItem through QGraphicsProxyWidget) or QGraphicsItem in a wrapper class of QDeclarativeItem:
1) Create a class that inherits QDeclarativeItem.
2) Create your QGraphicsItemb-based object or QWidget-based one, where the latter is subsequently added to a QGraphicsProxyWidget.
3) Set the successor of the QDeclarativeItem to be parent of the custom item.
4) Override the:
in the successor of QDeclarativeItem.Qt Code:
To copy to clipboard, switch view to plain text mode
5) In the overridden method above, make so that when the scene of the QDeclarativeItem is changed, change the scene of your custom item!
This should not be needed since the custom item is parented to the QDeclarativeItem's successor, but tests proven it was needed. Somehow the QDeclarativeItem's successor doesn't automatically add/remove child items to/from the scene.
Bookmarks