Results 1 to 7 of 7

Thread: Accessing check state of CheckBox in QTableWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: Accessing check state of CheckBox in QTableWidget

    the program halts on a signal at that line
    you mean you get segmentation fault? So check which of these many function calls in this line causes this seg fault. What item->column() returns?
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  2. #2
    Join Date
    Nov 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    3

    Default Re: Accessing check state of CheckBox in QTableWidget

    Not a segfault, I get this:
    Qt Code:
    1. ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt4/QtCore/qlist.h, line 403
    To copy to clipboard, switch view to plain text mode 

    when I try to use sender[6] to get the row and/or column.

    This looks to me that ther is no sixth column in the table, but there is. I can force it to get column six by hardcodeing in a 6,
    Qt Code:
    1. QCheckBox *mcb = qobject_cast<QCheckBox*>(m_ui->tableWidget->cellWidget(item->row(), 6));
    To copy to clipboard, switch view to plain text mode 

    but I can't get column six using
    Qt Code:
    1. QCheckBox *mcb = qobject_cast<QCheckBox*>(m_ui->tableWidget->cellWidget(item->row(), selected[6]->column()));
    To copy to clipboard, switch view to plain text mode 

    Why!?

    Had to wrap the Assert in code or the second colon after QList<T> showed up as a smilie..

Similar Threads

  1. Replies: 3
    Last Post: 1st April 2011, 04:58
  2. how to check button state such as "hover"?
    By billconan in forum Qt Programming
    Replies: 2
    Last Post: 12th November 2009, 01:45
  3. Help: How to save Check box state
    By Garibalde in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2009, 20:24
  4. Replies: 2
    Last Post: 5th June 2008, 21:32
  5. Replies: 0
    Last Post: 2nd May 2008, 07:57

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.