PDA

View Full Version : [SOLVED] QMainWindow open a new QMainWindow



xeroblast
2nd December 2010, 04:26
is it possible to open a new mainwindow from a mainwindow?

if it is... can you tell me how?

thanx...

xeroblast
2nd December 2010, 07:31
finally... thanx to this : http://www.qtforum.org/article/28674/multiple-qmainwindow.html

mainwindow.h


class mainWindow : public ..., private Ui..
{
private slots:
void openNewMainWindow();
}


mainwindow.cpp


#include "newmainwindow.h"
newMainWindow *newWin = 0;

mainWindow::mainWindow() : QMainWindow()
{
setupUi(this);
connect(buttonObjectName, SIGNAL(clicked()), this, SLOT(openNewMainWindow()));
}
void mainwindow::openNewMainWindow()
{
newWin = new newMainWindow();
newWin->show();
}


newmainwindow.h & newmainwindow.cpp are just common mainwindow apps...