PDA

View Full Version : multiple windows



NewLegend
9th September 2010, 01:46
Hello.

I don't find any example about creating multiple windows in QT4.

as,
Form1, Form2, Form3.
click Button in form1 then open form2


Can You give me some advice or example how to create multiple windows ?
Thanks

tbscope
9th September 2010, 04:40
Sure there is:
http://doc.qt.nokia.com/4.6/tutorials-addressbook.html

NewLegend
9th September 2010, 10:23
Sure there is:
http://doc.qt.nokia.com/4.6/tutorials-addressbook.html

Its not multiple Forms

tbscope
9th September 2010, 10:27
Yes it is!

Zlatomir
9th September 2010, 10:30
Here it is, another one:


#include <QApplication>
#include <QWidget>
#include <QDialog>
#include <QPushButton>
#include <QLabel>

int main(int argc, char** argv) {
QApplication a(argc, argv);

QWidget *w = new QWidget(0);
QPushButton *b = new QPushButton("Show Dialog", w);

QDialog *dlg = new QDialog(w);
QLabel *l = new QLabel(dlg);
l->setText("Hi, I'm a instance of QDialog class");

QObject::connect(b, SIGNAL(clicked()), dlg, SLOT(show()));

w->show();

int r = a.exec();
delete w;
return r;
}

You can replace the QWidget and QDialog with classes you inherit from them (with or without ui)

NewLegend
9th September 2010, 10:30
Yes it is!

;)

I want to work a set of Forms

tbscope
9th September 2010, 10:38
It's possible I don't understand what you ask. I regularly have that problem.

But in the addressbook tutorial, they create a find dialog:
http://doc.qt.nokia.com/4.6/tutorials-addressbook-part5.html

NewLegend
9th September 2010, 21:30
I want an example as follows
There is a list of the Left
When I click on Enviroment or Text Editor watch the forms


http://www.freeimagehosting.net/uploads/th.325196c7f7.jpg (http://www.freeimagehosting.net/image.php?325196c7f7.jpg)

http://www.freeimagehosting.net/uploads/th.829220a95b.jpg (http://www.freeimagehosting.net/image.php?829220a95b.jpg)

tbscope
10th September 2010, 05:38
Hmmm, this doesn't have anything to do with multiple windows.
Please, next time try to ask a better question.

What you want is a listwidget on the left and a stacked widget on the right.
When you click on a listwidgetitem in the list, you can bring a certain widget in the stacked widgets to the front.

http://doc.qt.nokia.com/4.6/dialogs-configdialog.html