Important: Please read the Qt Code of Conduct -

Changing layout depent on class

  • Good morning everyone,

    The problem is the following:
    I have a base class, that has many derivatives. During the program different derivatives will be selected...

    I have a widget which shall show some controls (info labels, buttons, etc.), but the controls will differ from one derivative to the other. How can I change the layout by the selected derivative AND catch signals to interact with it?


  • If I got it right, you are looking for "Dynamic Layout".

    There is an example in the Qt Demo.

  • Moderators

    You could have the derived classes all return a widget and embed those into a static layout. We do that a lot in Creator: e.g. the Projects mode is basically widgets from all kinds of plugins merged into one common layout.

Log in to reply