Results 1 to 13 of 13

Thread: QWizard - mandatory fields

  1. #1
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question QWizard - mandatory fields

    Per the manual the * make the field in QWizardPage manadory, i.e. the button "Next" enables only when that field is filled.

    I do:

    registerField("field*", lineEdit);

    and that works fine with QLineEdit but the same thing doesn't fly with QTextEdit. I do:

    registerField("field*", textEdit, "plainText");

    (I have to add "plainText" since textEdit is not a default property of QWizardPage)
    and that doesn't work - the button "Next" does not get enabled when that textEdit gets filled.
    I've tried:

    registerField("field*", textEdit, "plainText", "textChanged");

    didn't help either...

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWizard - manadatory fiels

    Qt Code:
    1. registerField("field*", textEdit, "plainText", SIGNAL(textChanged()));
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

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

    slava (11th February 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question Re: QWizard - mandatory fields

    Thank you very much, this is working now.
    Can I ask one more quesiton?
    Is it possible to change mandatority of the fielf later as a condition from some event? Like if a user chooses "Yes" in the comboBox, the field is mandatory, if user chooses "No", the field is not madatory. I have tried:

    Qt Code:
    1. Page::Page (QWidget *parent)
    2. : QWizardPage(parent)
    3. {
    4. .....
    5. registerField("field*", lineEdit);
    6. ....
    7. }
    8.  
    9.  
    10. void Page::event()
    11. {
    12. if (comboBox->currentIndex() == 0) registerField("field*", lineEdit)
    13. else registerField("field", lineEdit)
    14. }
    To copy to clipboard, switch view to plain text mode 
    ... i.e. put the "field" with the * or without it?
    Last edited by jpn; 11th February 2008 at 11:04. Reason: missing [code] tags

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWizard - mandatory fields

    It might prove to be easier to simply connect QComboBox::currentIndexChanged() to QWizardPage::completeChanged() and re-implement QWizardPage::isComplete().
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    slava (12th February 2008)

  7. #5
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question Re: QWizard - mandatory fields

    Thank you very much!

    And the last question, please....
    I have sorted out those mandatory fields thing, but the last thing I need to resolve is the size of the pages.
    Whatever size I put for the QWizardPages to be it does not change anything, I can not strach the window by a mouse and there is no maximize button at the top of the window.
    I have tried
    resize(...., ...)
    etc, but nothing helped...

  8. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWizard - mandatory fields

    You could try passing Qt::Window as second parameter to QWizard constructor if you want to make it appear as an ordinary window instead of a dialog.
    J-P Nurmi

  9. #7
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question Re: QWizard - mandatory fields

    sorry, how do I do that, in the header file?

  10. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWizard - mandatory fields

    Qt Code:
    1. QWizard wizard(parent, Qt::Window); // <---
    2. wizard.addPage(...);
    3. wizard.addPage(...);
    4. ...
    5. wizard.exec();
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  11. #9
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question Re: QWizard - mandatory fields

    I did it. The "maximize" button appeared but when I press it it streaches out the window to the maximum only vertically, the horizontal size still stays the same

  12. #10
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWizard - mandatory fields

    Did you set any maximum sizes (widths) and/or did you adjust any size policies?

    Edit: Oh, and which platform are you working on? Could you edit your user profile to indicate that? Thanks.
    J-P Nurmi

  13. #11
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Question Re: QWizard - mandatory fields

    not for the whole form. I have some size policies for the widgets and spacers inside the form so they streaches out correctly but no size policies for the whole form.
    I did the pages in QT Designer, then converted them by uic and inserted the result into my program. In the Designer in the Form Preview I have the maximize button and it work fine, but when I insert it to the overall program I get that trouble.
    I work on Windows for now.

  14. #12
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWizard - mandatory fields

    I can assure you that it works with minimal test wizard. Did you subclass QWizard? If so, I'd suggest trying out with a plain QWizard to see if your subclass does something faulty. Furthermore, if it doesn't resolve the problem, try leaving out page by page to see which page could cause it.
    J-P Nurmi

  15. The following user says thank you to jpn for this useful post:

    slava (12th February 2008)

  16. #13
    Join Date
    Feb 2008
    Posts
    43
    Thanks
    14

    Thumbs up Re: QWizard - mandatory fields

    I found it! It was the pictures at the top and at the left which was set by setPixMap, they were limiting the sizes of the window, once I took those off the window got able to be any size.
    thank you!

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.