Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set name of custom widget in Qt designer?
Forum Updated to NodeBB v4.3 + New Features

How to set name of custom widget in Qt designer?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    ViRuSTriNiTy
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • V Offline
      V Offline
      ViRuSTriNiTy
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved