Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching new form by a button click in qt gui application?

I am trying upon some simple applications. I would like to know how to launch a new form by clicking a button from main window. Please explain this to me with a simple example.

like image 889
Ashok Jeev Avatar asked Feb 21 '11 10:02

Ashok Jeev


1 Answers

QT already comes with a simple example on how to create and show different types of windows and dialogs. Take a look here: Window Flags Example

Also if you already have a main widow in your application, you can take a look how it's shown (main function in your main.cpp) for your project and use the same technique:

MainWindowTest *testWindow = new MainWindowTest();
testWindow->show();

If you need to show a modal dialog, use your dialog's exec() method:

Dialog *dialog = new Dialog();
dialog->exec();

hope this helps, regards

like image 194
serge_gubenko Avatar answered Sep 21 '22 22:09

serge_gubenko