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

Elvis Stansvik elvstone at gmail.com
Sun Nov 11 12:30:40 GMT 2018


Den sön 11 nov. 2018 kl 13:01 skrev Phil Thompson <phil at riverbankcomputing.com>:
>
>
>
> > 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.

Alright, no problem.

Elvis

>
> Phil


More information about the PyQt mailing list