Results 1 to 3 of 3

Thread: Which signal to use when table item is checked

  1. #1
    Join Date
    Jun 2008
    Posts
    13
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Which signal to use when table item is checked

    Hi, I am using QTableWidget and I am creating table items like this:
    Qt Code:
    1. QTableWidgetItem *cgname = new QTableWidgetItem(desc);
    To copy to clipboard, switch view to plain text mode 
    then i set it checked:
    Qt Code:
    1. cgname->setCheckState(Qt::Checked);
    To copy to clipboard, switch view to plain text mode 
    and intset to table
    Qt Code:
    1. cgTableWidget->setItem(row, 0, cgname);
    To copy to clipboard, switch view to plain text mode 
    I want to modify some data when checkbox becomes checked/unchecked, so i probably need to use some signal for this, but which one? I have looked at QTableWidgetItem documentation and have not found it Hope you can help me.
    Last edited by zolookas; 6th September 2008 at 11:44. Reason: spelling error

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Which signal to use when table item is checked

    I think you are looking for
    Qt Code:
    1. void QTableWidget::itemClicked ( QTableWidgetItem * item ) [signal]
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. void QTableWidget::itemActivated ( QTableWidgetItem * item ) [signal]
    To copy to clipboard, switch view to plain text mode 
    I'm a rebel in the S.D.G.

  3. #3
    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: Which signal to use when table item is checked

    In fact, the correct signal would be QTableWidget::itemChanged(). However, it will be emitted whenever any data of the item changes. Let it be text, color, check state or any other role. A new signal "itemCheckStateChanged()" has been proposed to TT, but unfortunately they rejected the idea. See also QxtTableWidget, which does provide such convenience signal.
    J-P Nurmi

Similar Threads

  1. Item Delegate Painting
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 07:37
  2. Checked item in QTreeWidget?
    By vishal.chauhan in forum Qt Programming
    Replies: 18
    Last Post: 3rd January 2008, 20:18

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.