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

Elvis Stansvik elvstone at gmail.com
Sun Nov 11 11:14:46 GMT 2018


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?
>
> Cheers,
> Elvis


More information about the PyQt mailing list