PDA

View Full Version : Customizing QWizard default buttons



srinirc
19th November 2009, 12:05
Hi
I have wizard in my application based on QWizard class. I need to do the following. Any help will be appreciated.

1) How to set styleSheet to wizard default buttons like Cancel, Next, Back? Also I need to set styleSheet differently for first page disabled Back button and other pages enabled Back button.
2) How to change position of wizard default buttons?
3) How to disable Cancel button in final page of Wizard?

high_flyer
19th November 2009, 13:23
All your questions are answered in the documentation.
You really should start by RTFM.

1) How to set styleSheet to wizard default buttons like Cancel, Next, Back? Also I need to set styleSheet differently for first page disabled Back button and other pages enabled Back button.
A. get the button using QWizard::button()
B. Once you have the button use setStyleSheet() for that specific button
For pages its the same, once you construct your page use setStyleSheet() to set its stylesheet.

2) How to change position of wizard default buttons?
Have a look at QWizard::setButtonLayout().

3) How to disable Cancel button in final page of Wizard?
If the QWizard doesn't offer its own method for it, getting the button and then setEnabled(fasle) should also work.

srinirc
19th November 2009, 15:41
Hi
Thanks. 1) and 3) answers did work.

2) How to change position of wizard default buttons?

Related to this I don't want to change order of buttons, I want to change position of buttons relative to wizard edges.

high_flyer
19th November 2009, 16:45
Related to this I don't want to change order of buttons, I want to change position of buttons relative to wizard edges.
Well, there is so much you can do without sub classing.

You might try however, getting the wizards layout, and iterating in it, to see if the buttons are in it, or in a sub layout of the main layout.
If they are, you can change the layout margins as you like.
Another way to know this is by looking in the QWizard code.