[SOLVED] Designer: Promoting to QDockWidget subclass



  • 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!



  • 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



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


Log in to reply
 

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