Results 1 to 20 of 20

Thread: How to hide all wizard buttons

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to hide all wizard buttons

    Hi,

    I have a wizard app with its wizardpages and in some of them, I want to hide ALL wizardbuttons.

    My wizard is declared this way:

    Qt Code:
    1. class BaseWizard : public QWizard
    To copy to clipboard, switch view to plain text mode 

    And I've tried this on the constructor:
    Qt Code:
    1. BaseWizard::BaseWizard(QWidget *parent) :
    2. QWizard(parent),
    3. ui(new Ui::BaseWizard)
    4. {
    5.  
    6. this->button(QWizard::NextButton)->setVisible(false);
    7. this->button(QWizard::CancelButton)->setVisible(false);
    8. this->button(QWizard::BackButton)->setVisible(false);
    9. this->button(QWizard::FinishButton)->setVisible(false);
    10. this->button(QWizard::CustomButton1)->setVisible(false);
    To copy to clipboard, switch view to plain text mode 

    And also with setEnabled(false) and with hide() and yes, Cancel, and CutomButton disappear BUT Next and Back always remain there. I tried to put it too in the initializepage() of the wizardpage but its the same.

    Any idea of why do that buttons saty there? Or what am I doing wrong?

    Thank you so much!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to hide all wizard buttons

    Aside from the question of how you are supposed to navigate a wizard with no buttons... the Next button is controlled by the return value of nextId(). The Back button will likely be made visible if you navigated to this page from another.

  3. #3
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to hide all wizard buttons

    how you are supposed to navigate a wizard with no buttons
    Well in some pages I have my own buttons and as the interaction is full with keyboard that means that they user goes to the next page with Enter/Return key and back with backspace. So in that cases, wizard's buttons annoy more than anything cause they have no function and there is no reason to have something which has no use and can confuse the user.

    he Next button is controlled by the return value of nextId()
    Okey... so.... how can I 'not show that button' in a wizardpage?

    The Back button will likely be made visible if you navigated to this page from another.
    First it didn't work.. as I said I tried with all buttons and back and next always stays there -.-'' and second.... what about the first page?

    Thank you!

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to hide all wizard buttons

    So why don't you just live with the buttons and cause the Enter and Backspace keys to cause clicks on the Next and back buttons?

    I agree with ChrisW67 - you are implementing a very weird QWizard. If you don't like the standard behaviour, then why not just emulate a QWizard with a set of pages in a custom QStackedWidget? You would have absolute control over which page is shown when without having to worry about all those pesky buttons.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to hide all wizard buttons

    Quote Originally Posted by roseicollis View Post
    Well in some pages I have my own buttons and as the interaction is full with keyboard that means that they user goes to the next page with Enter/Return key and back with backspace. So in that cases, wizard's buttons annoy more than anything cause they have no function and there is no reason to have something which has no use and can confuse the user.
    So why are you using a wizard at all? Why not have a QStackedWidget with a bunch of pages?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to hide all wizard buttons

    So why don't you just live with the buttons and cause the Enter and Backspace keys to cause clicks on the Next and back buttons?
    Well.. it would be so extrange that in some pages you have next and back button for no reason... I have already implemented the behaviour of enter but its ugly to have things on the screen for no reason and that if you focus them, they do nothing (because the focus would be on them and not in any option of the screen)

    So why are you using a wizard at all? Why not have a QStackedWidget with a bunch of pages?
    The reason for that is that a work mate told me to do it with wizard structure so I did it. I suppossed that it was the best option and moreover, I never saw before the class StackedWidget until u mentioned it O.o I'll try to go with the wizard 'cause I have to finish that and I have no time to try to change it into a QStackedWidget but I will consider that in the futur or later if I need it.

    One question... if a QStackedWidget can have a lot of widgets and pages like the wizard... does that mean that I can use the same pages I have already on the wizardpage? I mean: Now I have a QWizard with a lot of QWizardPages... so could I have a QStackedWidget with a lot of QWizardPages? and so the change is just so little? Or would it be much more complicated?

    Thank you !!

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to hide all wizard buttons

    The wizard is implemented over QStackedWidget so basically yes, you can reuse your pages. Just remember wizard() will then return null.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to hide all wizard buttons

    Just remember wizard() will then return null.
    What do you mean with that?

    Another thing: On the QWizard constructor I have this:
    Qt Code:
    1. this->button(QWizard::NextButton)->setFocusPolicy(Qt::TabFocus);
    To copy to clipboard, switch view to plain text mode 

    I'm trying to set focus policy Qt::NoFocus on that wizardpages were I don't want to have that buttons (so at least user will see them but won't reach them with tab), on its constructors or initializePage() but the program ignores me. It always do what I put on the QWizard class constructor.

    For example:

    QWizard constructor: this->button(QWizard::NextButton)->setFocusPolicy(Qt::TabFocus);
    QWizardPage 1 where I don't want the buttons: wizard()->button(QWizard::NextButton)->setFocusPolicy(Qt::NoFocus);
    QWizardPage 2 where I want the buttons again: wizard()->button(QWizard::NextButton)->setFocusPolicy(Qt::TabFocus);

    result: on wp 1 and wp 2 its like setFocusPolicy(Qt::TabFocus);

    So... can't I switch between focuspolicies?

    Thank you!

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to hide all wizard buttons

    Quote Originally Posted by roseicollis View Post
    What do you mean with that?
    I mean QWizardPage::wizard() is not going to return a valid wizard pointer if you are not going to have a wizard but a stacked widget instead.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to hide all wizard buttons

    I'm trying to set focus policy Qt::NoFocus on that wizardpages were I don't want to have that buttons (so at least user will see them but won't reach them with tab), on its constructors or initializePage() but the program ignores me. It always do what I put on the QWizard class constructor.
    It is evident that you do not want the features of QWizard so stop tryng to bend it to your will and simply reimplement your multi-page dialog using QStackedWidget and whatever other logic you want. Switching approach is less effort than you have put into this thread.

  11. #11
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to hide all wizard buttons

    It's funny how some of us (and I am guilty as well) are so resistant to throwing out ineffective code that "sort of works but not really", when it is obvious (even while I am being resistant) that just biting the bullet and throwing it out would result in something that is so much cleaner and maintainable. Pack rat mentality, I suppose.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to hide all wizard buttons

    I never hestitate to throw away everything I've got and start from scratch. Unfortunately (at least for me) my workmates rarely share my point of view. How do you tell your boss that the thing you've been working on for the last two weeks should be trashed. And how do you explain you will just need two days to rewrite it? "So what have you been doing during those two weeks?"
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. using wizard
    By arjita in forum Newbie
    Replies: 14
    Last Post: 28th July 2012, 18:48
  2. Replies: 1
    Last Post: 29th September 2011, 11:14
  3. To Wizard or Not ?
    By fassage in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2009, 10:42
  4. Disabling Wizard Buttons in a QWizard
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 30th October 2007, 17:53
  5. How to add a Wizard ?
    By npc in forum Qt Tools
    Replies: 4
    Last Post: 24th July 2007, 14:28

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.