Creating Dynamic Properties in a custom widget that shows in Qt Designer



  • I need to add dynamic properties that shows in Qt Designer to a custom widget at runtime.

    I can create a dynamic property using
    @QObject::setProperty("myDynamicProp", QVariant(1234))@
    But this property does not show up in Qt Designer

    If I manually create the dynamic propety in Qt designer I can change it with
    @QDesignerFormWindowInterface * formWindow = QDesignerFormWindowInterface::findFormWindow(this);
    formWindow->cursor()->setWidgetProperty(this, QString("myDynamicProp"), QVariant(4321));@
    But if the property does not already exist in Qt designer this fails.

    Any ideas how to create Dynamic Properties that shows up in Qt Designers property editor?

    (I don't know what properties I need at compile time so Q_PROP.. is not an alternative.)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.