Important: Please read the Qt Code of Conduct -

Editing a QFrame using QtDesigner

  • Hello.
    I have a system of scenes and for each scene I would like to have my own set of buttons and other things.

    Now I create a separate QFrame and consistently add the necessary widgets from the code of a specific scene.

    I would like to be able to create separate forms that will relate to my QFrame and load them as needed.
    How can I do this?

  • Lifetime Qt Champion


    Do you mean have several "scenes" and be able to switch between them like with a QStackedWidget ?

  • @SGaist,
    OK, if I'm going to use QStackedWidget, can I create a separate widget using QtDesigner?

    I want to create my own widget in QtDesigner for each scene and load them when compiling, then just switch them using QStackedWidget. Is this correct?

  • @mrjbom said in Editing a QFrame using QtDesigner:

    load them when compiling

    Not sure what you mean here. Nothing gets "loaded" while compiling.

    You can design each of your widgets as separate .ui files from Designer. These will result in separate classes in C++ code, from the uic run on the .ui files.

    It is then up to you when these get created/instantiated at run time. You can create them dynamically, when wanted, via new MyWiget1(). And you can then insert each of these into a QStackedWidget via its addWidget(QWidget *widget) method. You show any one them at a given time via QStackedWidget::setCurrentWidget(QWidget *widget).

    Does that answer what you are seeking to do?

Log in to reply