How to set name of custom widget in Qt designer?



  • Hello everybody,

    i did not find any remarks in the docs about this issue. I added a custom widget to Qt designer by using QDesignerCustomWidgetInterface and returned the widget class name in the QDesignerCustomWidgetInterface::name() method. Now the designer displays the class name in the widget box. But i want a more readable widget name to be displayed like "My Button". How can i achieve this?

    Thanks in advance.

    So lonG
    Daniel



  • Ok, figured it out today by having a look at the designer source code.

    The designer converts the XML returned by

    QDesignerCustomWidgetInterface::domXml()

    into

    QDesignerCustomWidgetData

    by calling

    QDesignerCustomWidgetData::parseXml()

    The parseXml() method clearly states that one have to add the attribute displayname to the widget xml tag, for example:

    @<ui language="c++" displayname="My Custom Widget">
    <widget class="..." ...>
    ...
    </widget>
    </ui>@

    So long
    Daniel


Log in to reply
 

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