[PyQt] Equivalent of Q_PROPERTY's MEMBER for pyqtProperty?
sda at fstab.net
Sun Nov 11 13:38:35 GMT 2018
As I remember it's a mess but that sounds like my @pyqtify (oh what a bad name...) Decorator for @attr.s classes. I use it to create signals so my attrsmodel (for tree views) can be backed by attrs classes.
Basically for each attrs attribute it creates a property (Python by default, you can specify pyqtProperty instead if you want). The property is used to emit a signal on change. A separate object is created to house the signals and is accessible via epyqlib.utils.qt.pyqtify_signals(). In my case mostly I don't write that much because it's just backend in my model.
Hopefully someday I'll tidy up my library so it's a bit easier to follow and try out. Sorry.
On November 11, 2018 6:14:00 AM EST, Elvis Stansvik <elvstone at gmail.com> wrote:
>E.g. in C++ one can do:
> Q_PROPERTY(bool showFileDialog MEMBER m_showFileDialog NOTIFY
> bool m_showFileDialog = false;
> 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?
>PyQt mailing list PyQt at riverbankcomputing.com
More information about the PyQt