PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 1073 - QDeclarativeComponent.setParentItem fails when the desired parent is acquired from QDeclarativeView.rootObject()
: QDeclarativeComponent.setParentItem fails when the desired parent is acquired...
Status: NEW
Product: PySide
Classification: Unclassified
Component: QtDeclarative
: HEAD
: PC Linux
: P3 normal
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-11-29 19:29 EET by Henry Gomersall
Modified: 2012-03-08 16:57 EET (History)
9 users (show)

See Also:


Attachments
Demo python file (979 bytes, text/x-python)
2011-11-29 19:29 EET, Henry Gomersall
Details
The basic QML file (138 bytes, application/octet-stream)
2011-11-29 19:30 EET, Henry Gomersall
Details
The ScrollArea QML file (83 bytes, application/octet-stream)
2011-11-29 19:31 EET, Henry Gomersall
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Gomersall 2011-11-29 19:29:46 EET
Created attachment 456 [details]
Demo python file

So, it is my understanding that it is reasonable to add to a QML tree by
creating a QDeclarativeItem from a QDeclarativeComponent within Python, as per
the docs*, and then setting that item to have a parent which is an item from
the QML tree.

If the desired parent is the root of the tree, acquired from a QDeclarativeView
object with QDeclarativeView.rootObject(), then the following error is
encountered:
TypeError: 'PySide.QtDeclarative.QDeclarativeItem.setParentItem' called with
wrong argument types:
 
PySide.QtDeclarative.QDeclarativeItem.setParentItem(PySide.QtGui.QGraphicsObject)
Supported signatures:
 
PySide.QtDeclarative.QDeclarativeItem.setParentItem(PySide.QtDeclarative.QDeclarativeItem)

This bug manifested itself after bug 925 was fixed. If one reverts commit
3a4369cf80199d5ab0dd1b5bf80a81abe10902e7, then everthing works as expected.

I have attached 3 files: 

1) A basic QML file (with the root just being a container for a red rectangle
for the purposes of this demo).
2) The python file that defines a ScrollArea object (I used a scroll area to
show something actually happening or not).
3) The ScrollArea QML file.

The bug is demonstrated by commenting out either lines 34 or 37.

In the case of line 34 being uncommented, we attempt to make the ScrollArea a
child of root object and so the error occurs.

In the case of line 37 being uncommented, we make the ScrollArea a child of the
red rectangle, which works just fine.

* http://doc.qt.nokia.com/4.7-snapshot/qdeclarativecomponent.htm and
http://www.pyside.org/docs/pyside/PySide/QtDeclarative/QDeclarativeComponent.html
Comment 1 Henry Gomersall 2011-11-29 19:30:47 EET
Created attachment 457 [details]
The basic QML file
Comment 2 Henry Gomersall 2011-11-29 19:31:16 EET
Created attachment 458 [details]
The ScrollArea QML file
Comment 3 Henry Gomersall 2011-11-29 19:33:24 EET
Oh, just to clarify, the demo should respond to a mouse scrolling over the
window by printing out the scroll delta.
Comment 4 Matti Airas 2012-03-08 16:57:59 EET
PySide is now a Qt-addon and uses Qt Project's JIRA tool for tracking bugs.
Please verify that the bug is still valid and re-submit it in the address
below:

https://bugreports.qt-project.org/

Sorry for the inconvenience!