Results 1 to 6 of 6

Thread: Problem with QWizard (how to request a set of data on a QWizardPage k times??)

  1. #1
    Join Date
    Apr 2009
    Location
    Poland
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Exclamation Problem with QWizard (how to request a set of data on a QWizardPage k times??)

    Hello

    I am quite new to Qt so excuse me if my question is too noob for you. I have created an app which contains a QWizard (opened with File->New wizard). After several pages I get to a point where I have a page with 4 QLineEdit's (these are some parameters needed to select a bearing from a database). The problem is I would like to request those 4 parameters k times from the user and put them into arrays later (k was declared by the user a page before). Is it possible?? I am stuck. Please help, any clue would be hugely appreciated.

    Toby

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

    Default Re: Problem with QWizard (how to request a set of data on a QWizardPage k times??)

    You either need to have several instances of the same page or instead of the lineedits use a table of some kind (QTableWidget probably).
    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. The following user says thank you to wysota for this useful post:

    tobek123 (4th April 2009)

  4. #3
    Join Date
    Apr 2009
    Location
    Poland
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: Problem with QWizard (how to request a set of data on a QWizardPage k times??)

    Thanx for your answer, I have tried QTableWidget, I am wondering how to validate fields in this table, so that I am sure that the user has filled them all. With QLineEdit there was no problem, I created a RegExp, a Validator and called setValidator() on them plus setting them as mandatory fields , so the "Next" button was greyed as long as there was an acceptable input. I've traversed the documentation for QTableWidget and QTableWidgetItem but I see no setValidator() function, even as inherited from other objects. Any thoughts ??
    Last edited by tobek123; 4th April 2009 at 09:58.

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

    Default Re: Problem with QWizard (how to request a set of data on a QWizardPage k times??)

    There is no automatic validation available for QTableWidget. What you can do is validate input inside the table widget using the item delegate but it is only a validation of a single field. It won't tell you if all the fields were filled in. You have to provide your own validating function that will iterate through all rows and fields and perform the checks.
    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. #5
    Join Date
    Apr 2009
    Location
    Poland
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QWizard (how to request a set of data on a QWizardPage k times??)

    thank you, I will try it out then

  7. #6
    Join Date
    Apr 2009
    Location
    Poland
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Re: Problem with QWizard (how to request a set of data on a QWizardPage k times??)

    For anybody interested in a final solution, here it is. Using a QTableWidget with number of rows entered by the user a page before (mandatory field with an validator, so the value is 100% OK), 4 columns as I need 4 parameters, 2 important connections:

    1. connect(table, SIGNAL(itemChanged(QTableWidgetItem*)), this,
    SLOT(validationSlot(QTableWidgetItem*))); - every change in any item triggers a validation function which simply uses a QRegExpValidator on a QTableWidgetItem::text() and if the outcome is QValidator::Invalid function sets the text of this item to ""

    2. connect(table, SIGNAL(itemChanged(QTableWidgetItem*)), this,
    SIGNAL(completeChanged())); - needed for a correct reimplementation of isComplete() (triggered like above, everytime sb. changes a single cell) used for enabling/disabling the "Next" button, the isComplete() function body checks the bool outcome of an okToGo() function which checks if there are no empty items in the table (if there is anthing in there it must be good because of the validator)

    Thank you for your help wysota, I appreciate it

Similar Threads

  1. problem with Synchronous Http request
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 30th January 2009, 11:03
  2. Replies: 7
    Last Post: 29th August 2008, 10:24

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
  •  
Qt is a trademark of The Qt Company.