[Qt-interest] How to fix the size of QWizard

Stephen Jackson spjackson42 at gmail.com
Wed Sep 2 09:39:58 CEST 2009


On Tue, Sep 1, 2009 at 10:44 AM, Rahulkumar Tibdewal wrote:
>
> I am struggling in making a fixed size QWizard. Can anyone help me?
>

I notice that you got no replies yesterday, and you posted a similar
message the previous day without reply. You might have more success if
you ask something specific. See
http://catb.org/~esr/faqs/smart-questions.html

Because of your vagueness I don't really know if this will help you,
but here goes...

There's a FAQ that tells you how to fix the size of a QDialog:
http://qt.nokia.com/developer/faqs/faq.2007-05-04.2217537068 and
QWizard is derived from QDialog. So Let's find an example and
translate that to code...

diff -Nru  /opt/qtsdk-2009.02/qt/examples/dialogs/trivialwizard/trivialwizard.cpp
trivialwizard.cpp
--- /opt/qtsdk-2009.02/qt/examples/dialogs/trivialwizard/trivialwizard.cpp
     2009-04-22 00:57:36.000000000 +0100
+++ trivialwizard.cpp   2009-09-01 11:32:05.000000000 +0100
@@ -128,6 +128,14 @@
     wizard.addPage(createRegistrationPage());
     wizard.addPage(createConclusionPage());

+    QLayout * layout = wizard.layout();
+    if (layout) {
+        layout->setSizeConstraint(QLayout::SetFixedSize);
+    }
+    else {
+        wizard.setFixedSize(QSize(600, 200));
+    }
+
     wizard.setWindowTitle("Trivial Wizard");
     wizard.show();

And that works as one would expect.

Does this help you?

-- 
Regards,

Stephen Jackson



More information about the Qt-interest-old mailing list