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. [SOLVED] Designer: Promoting to QDockWidget subclass
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Designer: Promoting to QDockWidget subclass

Scheduled Pinned Locked Moved General and Desktop
qtcreatorqt designer
3 Posts 2 Posters 1.9k Views 2 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.
  • Resurr3ctionR Offline
    Resurr3ctionR Offline
    Resurr3ction
    wrote on last edited by Resurr3ction
    #1

    I have a strange problem most likely because of me misunderstanding how this works. I use designer for visualising how my widgets look like. I have a QMainWindow subclass and QDockWidget sub-class. I then add QDockWidget to the main window form in designer and promote it to my sub-class. But it does not work. While I can use it like my class in code of main window, it does not appear like my widget when compiled. I used the promotion feature in the past with other widgets and it worked (even on QMenuBar or other "embedded" widgets). Am I missing something? Even rebuilding did not work.

    I suspect that it might be due to QDockWidget being actually two widgets - the dock and contents widget. So when I promote the dock widget only the dock is promoted but the content widgets remain the same. Is there a way to reconcile this in the designer?

    I can of course fall back to code but I would like to understand this all the same. Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      as you said QDockWidget is only a container (usually you don't need to create sub-class of it).
      Instead you need to sub-class and promote the contents

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • Resurr3ctionR Offline
        Resurr3ctionR Offline
        Resurr3ction
        wrote on last edited by
        #3

        Ok, thanks, I did as you said and sub-classed QWidget instead and promoted only the contents. Works like a charm. :-)

        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