Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QT - Visual form inheritance
Forum Updated to NodeBB v4.3 + New Features

QT - Visual form inheritance

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 3 Posters 2.2k 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.
  • K Offline
    K Offline
    Kobid
    wrote on last edited by
    #1

    Hi,

    I'm newbie in QT. I came from delphi IDE. I can't find solution to inherit from form. For example: In delphi project I had own TBaseForm class with controls created using designer (.dfm file, similar like .ui in QT creator). When create new form, I could select form from project and then new form had all controls from base form. Furthermore, changing controls in base form had affects in all descendants in real time. Can I do something similar in QT Creator?

    Regards

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Unfortunately: no, not really.

      There are currently two ways to use your previously created widgets within designer:

      Create a plugin for them

      Use the widget promotion feature

      The first option is the most powerful, as it allows you to really see and manipulate your widgets inside of your form. However, it does require you to build and install plugins for all of them, and that in turn requires that you have a version of Creator that you can build these for (so, you have the same toolchain as was used to build your creator). In my case, that means re-building all of creator. It works, but it is some work to set it up. The actual plugin is mostly just filling in some boiler plate stuff.

      The second option is much easier to do, but harder to use. You can 'promote' a widget that you use in your form to really act as a placeholder for one of your custom widgets. That means that at design time, you see the place holder widget only, and you also get only that behavior. However, no re-building of Creator and programming plugins is needed.

      I'd wish there was some way to directly include a widget from a .ui file into another .ui file, but so far, there isn't.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #3

        This can be very convenient. Maybe it should be added to feature request?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kobid
          wrote on last edited by
          #4

          Thanks for replies. I will try your tips

          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