[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] causes self to be owned by Qt instead of PyQt ???
From:       Baz Walter <bazwal () ftml ! net>
Date:       2015-04-02 18:37:15
Message-ID: 551D8C5B.80805 () ftml ! net
[Download RAW message or body]

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.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic