[PyQt] causes self to be owned by Qt instead of PyQt ???
Phil Thompson
phil at riverbankcomputing.com
Thu Apr 2 22:11:31 BST 2015
On 02/04/2015 7:37 pm, Baz Walter wrote:
> On 02/04/15 18:33, Phil Thompson wrote:
>> On 02/04/2015 5:38 pm, Baz Walter wrote:
>>> On 02/04/15 17:18, Andreas Pakulat wrote:
>>>
>>> QAbstractItemModel.parent(QModelIndex) overloads QObject.parent(), so
>>> it is a bug in PyQt4/5 that it doesn't support the latter.
>>
>> Eh? The QAbstractItemModel parent() hides the QObject parent().
>
> No, it shouldn't do. A QAbstractItemModel is a QObject. It takes
> another QObject as its parent, not a QModelIndex:
>
>>>> from PyQt4 import QtCore, QtGui
>>>> app = QtGui.QApplication([])
>>>> model = QtGui.QStandardItemModel(app)
>>>> model.parent()
> <PyQt4.QtGui.QApplication object at 0x7f397aae0c18>
>>>> model.parent(QtCore.QModelIndex())
> <PyQt4.QtCore.QModelIndex object at 0x7f3975078358>
>
> QAbstractItemModel::parent(QModelIndex) is virtual, but
> QObject::parent() isn't, so it cannot not be overridden.
So the attached C++ code should compile?
Phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c
Size: 230 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150402/b23d3714/attachment-0001.bin>
More information about the PyQt
mailing list