[PyQt] causes self to be owned by Qt instead of PyQt ???

Baz Walter bazwal at ftml.net
Thu Apr 2 17:38:53 BST 2015


On 02/04/15 17:18, Andreas Pakulat wrote:
> On Thu, Apr 2, 2015 at 3:18 PM, redstone-cold <redstone-cold at 163.com> wrote:
>>
>> Ok, this is the example
>> https://bpaste.net/show/a5b2b50e5052
>>
>> BTW,if you comment print(model.parent()),then console show
>> QObject::startTimer: QTimer can only be used with threads started with
>> QThread
>>
>> what's wrong in the code ?
>
> QAbstractItemModel.parent() require an argument, so calling it without an
> argument is a bug.
>
> And the message is printed regardless of wether the print is there or not,
> thats likely an internal issue in Qt.

QAbstractItemModel.parent(QModelIndex) overloads QObject.parent(), so it 
is a bug in PyQt4/5 that it doesn't support the latter.

That doesn't explain what is wrong with the code though. The problem 
there is the same as the other example the OP posted, and has the same 
kinds of solutions (e.g. give the model a parent, or use 
sip.setdestroyonexit(False)).

--
Regards
Baz Walter


More information about the PyQt mailing list