QRect
is behaving properly. You should check the geometry()
, not the rect()
.
http://doc-snapshot.qt-project.org/4.8/qwidget.html#geometry-prop
http://doc-snapshot.qt-project.org/4.8/qwidget.html#rect-prop
http://doc-snapshot.qt-project.org/4.8/application-windows.html#window-geometry
Here are some QWizard
examples that are worth studying...
http://qt-project.org/doc/qt-4.8/dialogs-trivialwizard.html
http://qt-project.org/doc/qt-4.8/dialogs-classwizard.html
http://qt-project.org/doc/qt-4.8/dialogs-licensewizard.html
Generally speaking...
Using Layouts, makes your life easier. There is a learning curve and the code looks funny at first, but you will be grateful that you did in the long run. If at all possible, I avoid using Qt Designer, and I use layouts, and nested layouts to position everything. Add in stretches and spacers and anything else you need. It's great. And then if you need something to show or hide later, you nest that in a QWidget
, and you show and hide that widget to adjust when it is visible.
http://qt-project.org/doc/qt-4.8/layout.html
http://qt-project.org/doc/qt-4.8/tutorials-widgets-windowlayout.html
It might be that when a QRadioButton
is added without a layout, it isn't updating your widget.
If you change what is in your widget, you need to post an update()
event for it to be reflected.
http://doc-snapshot.qt-project.org/4.8/qwidget.html#update
Also when you don't use layouts, the layering and positioning can go a little crazy. Make sure that you are not drawing something else on top of the location where the button is added.
Here is some more things to keep in mind. Though it looks like you may be taking care of some of this already...
Another issue that can happen is if you add a QRadioButton
not into a layout and forget to parent it, it probably won't get added at all. Parenting of QObject
s is handled nicely by layouts, too.
And finally, you need to make sure that your button exists for the scope of your parent widget. So if you declare it in a slot, and it has a local scope, by the time you leave the slot, it is gone. (You put it on the heap, so it should be okay).
So make it a member variable for your subclassed QWizardPage
, and make it a pointer. Qt handles the parenting of objects well, and the deletion correctly if they are on the object tree properly.
http://qt-project.org/doc/qt-4.8/objecttrees.html
Also be sure to look at using a 'QGroupBox' in your layout when you are using QRadioButton
s. This handles the exclusive attribute well.
http://doc-snapshot.qt-project.org/4.8/widgets-groupbox.html
http://doc-snapshot.qt-project.org/4.8/qradiobutton.html#details
Hope that helps.