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

Phil Thompson phil at riverbankcomputing.com
Fri Apr 3 09:19:22 BST 2015


On 02/04/2015 11:54 pm, Baz Walter wrote:
> On 02/04/15 23:01, Andreas Pakulat wrote:
>> Hi Phil,
>> 
>> On Thu, Apr 2, 2015 at 11:11 PM, Phil Thompson 
>> <phil at riverbankcomputing.com>
>> wrote:
>>> 
>>> So the attached C++ code should compile?
>> 
>> Not without a fix for qfilesystemmodel.h. qabstractitemmodel.h as well 
>> as
>> qstandarditemmodel.h (and probably other qaim subclasses in qt) 
>> explicitly
>> 'reuse' QObject::parent using something like:
>> 
>> #ifdef Q_NO_USING_KEYWORD
>>      inline QObject *parent() const { return QObject::parent(); }
>> #else
>>      using QObject::parent;
>> #endif
>> 
>> For qfilesystemmodel.h this is missing and hence one cannot call
>> QObject::parent() with a pointer or instance of it.
> 
> Huh. So is it a Qt bug, then? Seems a little strange that it has gone
> unnoticed for so long (since at least 4.7). But maybe there's a
> specific reason why QFileSystemModel is be treated differently to all
> the other model classes.
> 
> Looks like Q_NO_USING_KEYWORD has been completely removed in Qt-5.5,
> but obviously that didn't touch qfilesystemmodel.h, so parent() is
> still missing there.

...so it's not a PyQt bug :)

Phil


More information about the PyQt mailing list