Qt World Summit: Submit your Presentation

Exposing Q_PROPERTY in Qt Designer with class deriving from an object with Q_GADGET

  • I have several widgets I am exposing in the Qt Designer. I have been going through and changing many of them to use Q_PROPERTY to expose properties in the property editor in Qt designer. Some of these widgets are derived both from QWidget, and other non-QObject based classes. There are some properties in these non-QObject based classes I would also like to expose to the property editor. I have attempted to do so by adding the Q_GADGET macro:

    class CCustomEditor: public QLineEdit, public CBaseInformation
    class CBaseInformation
    	Q_PROPERTY(QString owner  READ GetOwner WRITE SetOwner)

    However, the property does not appear in the Qt Designer property editor pane. Is it possible to expose properties in this manner, or is it only possible to expose properties in classes derived from QObject?

Log in to reply