Multiple windows (user interfaces)
-
Hello,
how to have more than one UI and change between them with UI2.Show(); for example.
Thank you
-
I'm not quite sure about your question but there is nothing that stops you from having multiple top-level widgets (widgets having no parent, thus becoming an independent window).
@
QWidget *widgetA = new QWidget;
QWidget *widgetB = new QWidget;widgetA->show();
widgetB->show();
@ -
Ok, I can understand your idea. But I want to edit the widget in the designer because this is very convenient.
So, the difference would be: I want to create the QWidget when compiling, following your idea, it would be created at runtime.
Would be very nice if there is a way you can tell me :)
-
Hi,
sorry I do not 100% understand the problem.
Let me try to re formulate:
You want an application with several top level windows.
you want to design those windows with designer
All this si done during developement so no need to load *.ui files at runtime.
Is this correct? If yes, do it the same way as with one designer created file :-) Replace QWidget from Lukas example with your class names, that is it.
-
Thank you, this was a correct interpretation.
At first I just wanted to know how to add a new UI file to my project, it was File>New>Qt>Qt Designer Form>templates\forms>Main Window.
But do I really need "new QWidget" if the Widget as is exists in the file which I have already added to my pro file ?
And how to call the form (by its filename? )?, btw I named it mainwindow2.uiThank you for help, still learning.