PDA

View Full Version : how to create window that opened when close main window??



Abeer
16th May 2010, 12:16
Hi everyone ..

Iam a absolute Beginner in QT..

i am trying to create window that has only text and one push button when you press it, you will get another window that has menu for program ..

but Unfortunately, i didn't know how can i create new window and connect it with main window!

so, i need to helping you

wysota
16th May 2010, 12:26
Take a look at QMessageBox

Zlatomir
16th May 2010, 13:00
You want something like a splash screen (http://doc.qt.nokia.com/4.6/qsplashscreen.html) before open the main window of your application?

Abeer
16th May 2010, 13:24
You want something like a splash screen (http://doc.qt.nokia.com/4.6/qsplashscreen.html) before open the main window of your application?

No, i don't
it is not important..

i just need to know how can open window from main window and so on..

squidge
16th May 2010, 13:53
When main window close, event loop terminate, then you can open second main window.

Abeer
16th May 2010, 14:17
When main window close, event loop terminate, then you can open second main window.

ok, but i didn't know how can connect second main window with first main window..
clearly,i don't know how can deal with code of window classes exactly!

maybe i need to see some examples..
Unfortunately,i can't find it..

thanks..

Zlatomir
16th May 2010, 14:56
Do you need something like this?


#include <QtGui>
int main (int argc, char** argv) {
QApplication ap(argc, argv);

QWidget *window1 = new QWidget(0);
QWidget *window2 = new QWidget(0);

QPushButton *button = new QPushButton("Open second Window", window1);

window1->show();

QObject::connect(button, SIGNAL(clicked()), window2, SLOT(show()));

return ap.exec();
}

Abeer
16th May 2010, 15:07
Do you need something like this?


#include <QtGui>
int main (int argc, char** argv) {
QApplication ap(argc, argv);

QWidget *window1 = new QWidget(0);
QWidget *window2 = new QWidget(0);

QPushButton *button = new QPushButton("Open second Window", window1);

window1->show();

QObject::connect(button, SIGNAL(clicked()), window2, SLOT(show()));

return ap.exec();
}



yes yes like this...
thanks a lot
thanks a lot Zlatomir :)

i will try to do that in my application
and try to add menu and a lot of things in second window

i am grateful for you..

wysota
16th May 2010, 15:09
i just need to know how can open window from main window and so on..

http://www.qtcentre.org/faq.php?faq=qt_general_category#faq_qt_designer_2f orms

Abeer
16th May 2010, 16:21
thanks for all..
i created second window from my main window and now i will add to it menu and other things..


i am grateful:)