Results 1 to 4 of 4

Thread: Help with QWizard

  1. #1
    Join Date
    Jul 2008
    Posts
    48
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Help with QWizard

    Hi everyone,

    This time I'm facing a new problem :\. When I register a field, in the initializePage() I cannot go back and forth again in the wizard because it will attempt to register that field again. Is it possible to unregister a field when I go back?

    Qt Code:
    1. void ObjectsPage::initializePage()
    2. {
    3. layout = new QGridLayout;
    4. QSpinBox* sbVel = NULL;
    5. QLabel* lblVel = NULL;
    6.  
    7. QString numLayers = field("numObjs").toString();
    8. int num = numLayers.toInt();
    9.  
    10. for (int i = 0; i < num; ++i) {
    11. sbVel = new QSpinBox();
    12. sbVel->setMinimum(500);
    13. sbVel->setMaximum(20000);
    14. sbVel->setSingleStep(500);
    15. sbVel->setValue((i+1)*500);
    16.  
    17. lblVel = new QLabel;
    18. lblVel->setText("Capa " + QString::number(i+1));
    19. sbObjs.push_back(sbVel);
    20. lblObjs.push_back(lblVel);
    21. layout->addWidget(lblVel, i, 0);
    22. layout->addWidget(sbVel, i, 1);
    23. registerField("sbVel" + QString::number(i), sbObjs[i]);
    24. }
    25.  
    26. setLayout(layout);
    27. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    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: Help with QWizard

    Register a field in the page constructor. initializePage() should be used to set default values to all the fields that may require initialization based on previous actions.
    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.


  3. #3
    Join Date
    Jul 2008
    Posts
    48
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Help with QWizard

    I thought about that, but the problem is.. the number of fields I'm going to have on the next page depends on the number chosen by the user on the previous page, so I don't really know which fields I'll be registering.

  4. #4
    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: Help with QWizard

    In that case the field mechanism doesn't seem very appropriate for the task. It's more likely that you want a table view or something like that. If you want to keep the field approach you can query the value of each field or keep the number of fields that are already registered and simply skip registering them again. If you want less fields than before then simply hide the excessive ones.
    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. QWizard fit
    By baray98 in forum Qt Programming
    Replies: 7
    Last Post: 14th November 2010, 16:27
  2. QWizard creating objects dynamically
    By afflictedd2 in forum Qt Programming
    Replies: 5
    Last Post: 24th March 2009, 15:43
  3. QWizard, QComboBox and registerField() issue
    By RThaden in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 12:18
  4. Create QWizard UI
    By jd in forum Qt Tools
    Replies: 1
    Last Post: 17th March 2008, 12:36
  5. QWizard and banner pixmap
    By desch in forum Qt Programming
    Replies: 8
    Last Post: 7th January 2008, 10: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.