[PyQt] PyQt5 Python3 custom widget, how to do a custom enum property

Phil Thompson phil at riverbankcomputing.com
Wed Oct 7 09:05:15 BST 2015


On 7 Oct 2015, at 7:01 am, cbg at openmailbox.org wrote:
> 
> Hello to all.
> I have made a custom widget that I can use in designer and in a python too.
> I want to add it a enum-property.
> I have see the examples of pyqt5, the datetimeedit.py have almost what that I need; a custom property with Qt enum (Qt.DayOfWeek, and another two propertys with others Qt enums).
> But how to do a property with custom enum (list or dict) that I can use in designer and in python code too?

Something like (I think)...

class MyObject(QObject):
    class MyEnum:
        value1 = 10
        value2 = 20

    Q_ENUMS(MyEnum)

Phil



More information about the PyQt mailing list