[PyQt] Equivalent of Q_PROPERTY's MEMBER for pyqtProperty?

Phil Thompson phil at riverbankcomputing.com
Sun Nov 11 12:01:30 GMT 2018



> On 11 Nov 2018, at 11:14 am, Elvis Stansvik <elvstone at gmail.com> wrote:
> 
> Den sön 11 nov. 2018 kl 12:14 skrev Elvis Stansvik <elvstone at gmail.com>:
>> 
>> Hi all,
>> 
>> E.g. in C++ one can do:
>> 
>>    Q_PROPERTY(bool showFileDialog MEMBER m_showFileDialog NOTIFY
>> showFileDialogChanged)
>> ...
>> public:
> 
> That was supposed to be private of course.
> 
> Elvis
> 
>>    bool m_showFileDialog = false;
>> ...
>> signals:
>>    void showFileDialogChanged();
>> 
>> This makes the m_showFileDialog member variable readable and writable
>> without the need of creating READ and WRITE accessor functions, and Qt
>> emits automatically the showFileDialogChanged signal when needed.
>> 
>> Is it possible to get this kind of convenience with PyQt?

No.

Phil


More information about the PyQt mailing list