Results 1 to 4 of 4

Thread: Customizing QWizard default buttons

  1. #1
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Customizing QWizard default buttons

    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?
    Thanks & Regards
    Srinivasa Rao Chigurupati

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Customizing QWizard default buttons

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    srinirc (19th November 2009)

  4. #3
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Customizing QWizard default buttons

    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.
    Thanks & Regards
    Srinivasa Rao Chigurupati

  5. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Customizing QWizard 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.
    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Disabling the buttons in QWizard
    By divya balachandran in forum Qt Programming
    Replies: 6
    Last Post: 13th October 2008, 22:46
  2. Disabling the buttons in QWizard
    By divya balachandran in forum Qt Programming
    Replies: 1
    Last Post: 17th September 2008, 18:52
  3. Disabling Wizard Buttons in a QWizard
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 30th October 2007, 17:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.