PDA

View Full Version : Problem QWizardPage not modal



Rooster1
19th December 2008, 12:40
hi all,
I've qt 4.4.0
On my QWizard I want to set a NOT MODAL QWizardPages, to take some values from qmainwindows behind the qwizardpage.
I cannot make this.
If I call cc.show() nothing is visualized, I must use cc.exec() but it creates a modal Dialog

I attach a piece of code



void MissionTree_Control::wizard_Show()
{
ClassWizard cc(m_parent);
// cc.exec();
cc.show();
std::cout<<";-)"<<std::endl;
}

ClassWizard::ClassWizard(QWidget *parent) : QWizard(parent)
{
addPage(new Intro_Page);
addPage(new GCS_Page);
setWindowTitle(tr("Mission definition"));
setWizardStyle(QWizard::ModernStyle);
}


Intro_Page::Intro_Page(QWidget *parent): QWizardPage(parent)
{
setWindowModality(Qt::WindowModal);
setTitle(tr("..."));
setPixmap(QWizard::WatermarkPixmap, QPixmap("..."));
...
}

GCS_Page::GCS_Page(QWidget *parent): QWizardPage(parent)
{
setWindowModality(Qt::NonModal);
setTitle(tr("..."));

}

janus
19th December 2008, 19:53
hi,

QWizardPage does not inherit QDialog. I guess you should set the modality within QWizard.

Rooster1
28th December 2008, 18:10
ok thanks.
I try this using the .show() method for visualize a not modal QWizard set of pages but nothig is showed..
I must use .exec() method but show a modal set of pages..

why the .show() method not func?

thank a lot

jpn
28th December 2008, 18:52
I must use .exec() method but show a modal set of pages..

It "works" in your case because QDialog::exec() blocks until the modal dialog is closed.



why the .show() method not func?

It works, but because show() doesn't block but returns immediately, the wizard goes out of scope and gets destructed according to normal C++ rules. You must use the C++ operator new to allocate the dialog on the heap.

Rooster1
30th December 2008, 10:04
Now it's ok! :)
Thank you very much!!!