[Qt-interest] QWizardPage::wizard() overprotected?
Andreas Pakulat
apaku at gmx.de
Thu Dec 11 16:00:48 CET 2008
On 11.12.08 15:06:24, Niels Dekker - no return address wrote:
> Andreas Pakulat wrote:
> > First of all, QWizard is a QDialog, embedding it into any
> > other widget is not a supposed usage of that class.
>
> Do you mean that it's simply impossible to place a wizard inside a
> QMainWindow, and have it work properly?
That depends on the implementation of QMainWindow, QWizard and QDialog. In
General QDialog is supposed to be a top-level window, so there might be
code that assumes this and you might get problems when embedding it into a
mainwindow. Besides a wizard with widgets, then the next/prev/finish
buttons and then a statusbar is pretty uncommon and might confuse users.
> > Why can't the statusbar be part of the page itself?
>
> That's a good question. It looks like Qt doesn't supports adding a statusbar
> to a dialog. At least not within the Qt4 Designer, or the VS Integration.
Well, some things you have to do manually. I don't really understand why
you have a .ui file for the dialog itself. After all you can't really
create wizard+wizardpages in Qt designer anyway. You can only create the
contents of the pages as separate forms and then use those with the code
that adds the pages to the wizard. So there's nothing that changes, except
that you'd insert a new class between your pages and QWizardPage which
provides the statusbar+setWidget() for the contents.
So you're not adding the statusbar to the dialog, but to the widget of the
page in your QWizardPage subclass. And then each individual page is a
subclass of that and just calls setWidget() with a widget generated from a
form.
BTW, this works:
#include <QtGui>
int main(int argc, char** argv)
{
QApplication app(argc,argv);
QWidget* myWidget = new QWidget();
QVBoxLayout* layout = new QVBoxLayout( myWidget );
myWidget->setLayout( layout );
QStatusBar* sb = new QStatusBar( myWidget );
layout->addWidget( sb );
sb->showMessage("Test");
myWidget->show();
return app.exec();
}
Andreas
--
You love peace.
More information about the Qt-interest-old
mailing list