Results 1 to 5 of 5

Thread: Mutually Exclusive Checks in QTableWidget cells

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 3 Times in 3 Posts

    Default Mutually Exclusive Checks in QTableWidget cells

    Is there a way to define sets of checkable cells in a QTableWidget so that at most one cell can be checked?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Mutually Exclusive Checks in QTableWidget cells

    Without looking deeper into that I see two options:

    1) connect to the table widget's itemChanged() signal and in the slot check if the item is checked and if it is uncheck all that are exclusive

    2) derive from QTableWidgetItem, reimplement setData() to intercept Qt::CheckRoleState and do the unchecking in there (or delegate to a class that does it)

    Cheers,
    _

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

    davethomaspilot (9th August 2014)

  4. #3
    Join Date
    Jun 2012
    Posts
    219
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 3 Times in 3 Posts

    Default Re: Mutually Exclusive Checks in QTableWidget cells

    Ok, I'll do option 1.

    Thanks,

    Dave Thomas

Similar Threads

  1. QTableWidget exclusive cells
    By bwnicewo in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2012, 00:25
  2. How to display cut cells in QTableWidget
    By danblanks in forum Qt Programming
    Replies: 0
    Last Post: 16th February 2011, 21:42
  3. read QTableWidget cells
    By navid in forum Newbie
    Replies: 8
    Last Post: 4th April 2010, 10:40
  4. Merging cells in QTableWidget
    By lyucs in forum Newbie
    Replies: 1
    Last Post: 22nd January 2010, 19:15
  5. Focus of cells in a QTableWidget
    By SailinShoes in forum Qt Programming
    Replies: 4
    Last Post: 9th June 2008, 08:19

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.