Perhaps someone might be able to assist with noting whether this is a bug or not. Any assistance would be *much* appreciated.
Regards, Henry On Thu, 2011-11-03 at 14:16 +0000, Henry Gomersall wrote: > I'm trying to load a QML component from python and then add it to the > root item of the my QML tree. > > This is documented in various locations, including to some extent in the > PySide docs (in the second code block of "Detailed description": > > http://www.pyside.org/docs/pyside/PySide/QtDeclarative/QDeclarativeComponent.html > > My code, which worked up until my last upgrade (which bumped PySide to > 1.0.6), was as follows: > > # __qml_view is an instance of QDeclarativeView > self.__qml_root = self.__qml_view.rootObject() > > # Set up the scroll area, this is a class defined in python > QtDeclarative.qmlRegisterType(ScrollArea, "ScrollArea", 1, 0, > "ScrollArea") > > scroll_area = QDeclarativeComponent(\ > self.__qml_view.engine(),\ > "ScrollArea.qml").create() > > scroll_area.setParentItem(self.__qml_root) > > The problem is that setParentItem() requires a QDeclarativeItem as its > argument, not a QGraphicsObject as it's getting. > > The code in the docs (which is C rather than Python) shows how to cast > the object created by .create(), which seems like it would be the right > thing to do for __qml_root, but its not clear to me how I do this in > Python. Is it possible? > > Did rootObject() previously return a QGraphicsObject rather than a > QDeclarativeItem? (which is why is worked before). > > How *should* I set the created item (scroll_area) to be a child of > self.__qml_root? > > Thanks, > > Henry > > _______________________________________________ > PySide mailing list > PySide@lists.pyside.org > http://lists.pyside.org/listinfo/pyside _______________________________________________ PySide mailing list PySide@lists.pyside.org http://lists.pyside.org/listinfo/pyside