Results 1 to 3 of 3

Thread: Verify fields in QTableWidget are complete?

  1. #1
    Join Date
    Mar 2011
    Posts
    82
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default Verify fields in QTableWidget are complete?

    I'm trying to check, for every row in a QTableWidget that all its column fields are filled with data.

    For each column I'm using delegates (different ones, for different data types), but I'd like to know if there's a certain "standard" or "elegant" way to resolve if all column fields are filled with data from QTableWidget?

    I want to be able to control wheter the tablewidget is complete, so that when the user clicks Accept it checks if the user's input is valid.

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

    Default Re: Verify fields in QTableWidget are complete?

    If you only want to check when they try to "accept" the whole table then the obvious approach of nested loops iterating over the rows and columns of the table checking that each cell is "complete" (by whatever definition) is as good as any. You could also determine the completion state once when the table is first loaded and maintain a current completion state by monitoring the cellChanged() signal: this would allow you to dynamically enable/disable an Accept button.

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

    alitoh (18th May 2011)

  4. #3
    Join Date
    Mar 2011
    Posts
    82
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default Re: Verify fields in QTableWidget are complete?

    Quote Originally Posted by ChrisW67 View Post
    If you only want to check when they try to "accept" the whole table then the obvious approach of nested loops iterating over the rows and columns of the table checking that each cell is "complete" (by whatever definition) is as good as any. You could also determine the completion state once when the table is first loaded and maintain a current completion state by monitoring the cellChanged() signal: this would allow you to dynamically enable/disable an Accept button.
    Yes, I'm trying to avoid the first one... but I never thought about that second one, which seems kinda nice. I'll try to do something with that.

    Thanks a lot.

Similar Threads

  1. qwizard and fields
    By GrahamLabdon in forum Newbie
    Replies: 2
    Last Post: 11th May 2011, 08:58
  2. Parsing UDP datagram fields
    By catto in forum Qt Programming
    Replies: 7
    Last Post: 23rd February 2011, 21:16
  3. automatically complete fields on the form
    By TomASS in forum General Programming
    Replies: 1
    Last Post: 13th July 2010, 20:14
  4. Replies: 3
    Last Post: 2nd September 2008, 00:57
  5. tr() and static fields
    By drkbkr in forum Qt Programming
    Replies: 6
    Last Post: 5th June 2007, 17:01

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.