April 24, 2012

pascal95abc pascal95abc
Lab Rat
121 posts

multiple windows (user interfaces)

 

Hello,

how to have more than one UI and change between them with UI2.Show(); for example.

Thank you

 Signature 

Qt 4.7.3
Symbian OS v9.4 / Symbian^1, S60 5th Edition
on N97

4 replies

April 24, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

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).

  1. QWidget *widgetA = new QWidget;
  2. QWidget *widgetB = new QWidget;
  3.  
  4. widgetA->show();
  5. widgetB->show();

April 24, 2012

pascal95abc pascal95abc
Lab Rat
121 posts

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 :)

 Signature 

Qt 4.7.3
Symbian OS v9.4 / Symbian^1, S60 5th Edition
on N97

April 25, 2012

Gerolf Gerolf
Hobby Entomologist
3287 posts

Hi,

sorry I do not 100% understand the problem.

Let me try to re formulate:

  1. You want an application with several top level windows.
  2. you want to design those windows with designer
  3. 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.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

April 25, 2012

pascal95abc pascal95abc
Lab Rat
121 posts

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.ui

Thank you for help, still learning.

 Signature 

Qt 4.7.3
Symbian OS v9.4 / Symbian^1, S60 5th Edition
on N97

 
  ‹‹ configuring Qt for imx-31 with opengl      Howto change the text "Exit" and "Options" in the menubar ››

You must log in to post a reply. Not a member yet? Register here!