
Originally Posted by
dcopeto
Hi,
how can make the wizard show up alone, and then when it finishes, the main window comes up?
My main.cpp code is this:
int main(int argc, char ** argv)
{
MainWindowImpl win;
win.show(); //shows the main window
win.data = new dataBase;
startWizard wizard(&win, &(win.data));
wizard.show(); //shows the wizard
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
}
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
MainWindowImpl win;
win.show(); //shows the main window
win.data = new dataBase;
startWizard wizard(&win, &(win.data));
wizard.show(); //shows the wizard
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
}
To copy to clipboard, switch view to plain text mode
thanks a bunch for the help,
david
Maybe this is what you need.
It wiil be simple if you use exec() for wizard. Mainwindow will show behind wizard, but not activated.
int main(int argc, char ** argv)
{
MainWindowImpl win;
win.show();
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
startWizard wizard;
wizard.exec();
return app.exec();
}
int main(int argc, char ** argv)
{
QApplication app( argc, argv );
MainWindowImpl win;
win.show();
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
startWizard wizard;
wizard.exec();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Also maybe this might be what you want, but this will be a little bit complicated.
I haven't tested yet.
In startWizard class:
#include "mainwindowimpl.h"
#include <QtGui>
Class startWizard : public QWizard
{
public:
startWizard(MainWindowImpl *mainWindow);
~startWizard();
...
...
private:
MainWindowImpl *m_mainWindow;
};
#include "mainwindowimpl.h"
#include <QtGui>
Class startWizard : public QWizard
{
public:
startWizard(MainWindowImpl *mainWindow);
~startWizard();
...
...
private:
MainWindowImpl *m_mainWindow;
};
To copy to clipboard, switch view to plain text mode
In startwizard.cpp:
startWizard::~startWizard()
{
mainWindow->show();
}
startWizard::startWizard(MainWindowImpl *mainWindow)
{
m_mainWindow = mainWindow;
}
startWizard::~startWizard()
{
mainWindow->show();
}
startWizard::startWizard(MainWindowImpl *mainWindow)
{
m_mainWindow = mainWindow;
}
To copy to clipboard, switch view to plain text mode
In main.cpp:
int main(int argc, char ** argv)
{
MainWindowImpl win;
startWizard wizard(&win);
wizard.exec();
return app.exec();
}
int main(int argc, char ** argv)
{
QApplication app( argc, argv );
MainWindowImpl win;
startWizard wizard(&win);
wizard.exec();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
I don't know if it helps.
Bookmarks