Results 1 to 6 of 6

Thread: QTableWidget with QCheckBox

  1. #1
    Join Date
    May 2009
    Location
    Austria
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Red face QTableWidget with QCheckBox

    Hello,

    I want to insert in my QTableWidget a Checkbox...
    I don`t know how I can do that...

    For example:
    In the first column have to be the Checkbox and in the second a QString...

  2. #2
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget with QCheckBox

    Check the Qt Examples and Demos, under the Widgets section, see the Icons demo. It has an example of what you're describing.

  3. #3
    Join Date
    May 2009
    Location
    Austria
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget with QCheckBox

    thanks...

    but i can`t found something about that what i want...
    do you have a little code example for me?

  4. #4
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    63
    Thanks
    1
    Thanked 22 Times in 19 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QTableWidget with QCheckBox

    It might not be possible to put QCheckBox for QTableWidget instead you need to put QTableWidgetItem item to table and then mark that as checkable. Next piece of code shows one way to add "checkboxes" for table:

    Qt Code:
    1. QTableWidgetItem *checkBoxItem = new QTableWidgetItem();
    2. checkBoxItem->setCheckState(Qt::Unchecked);
    3. table->setItem(row, column, checkBoxItem);
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Nov 2009
    Posts
    39
    Thanks
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget with QCheckBox

    Seriously, look here:

    http://doc.trolltech.com/4.6/widgets-icons.html

    In this example, in the bottom left corner, there's a TableWidget with a checkbox (as well as other widgets). There are links to code examples.

  6. #6
    Join Date
    May 2009
    Location
    Austria
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget with QCheckBox

    hi guys,

    thanks a lot for your help...
    it works

    bye

Similar Threads

  1. Replies: 1
    Last Post: 23rd October 2009, 22:48
  2. Set QCheckBox at QTableWidget Header
    By chatarpal in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2009, 15:19
  3. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.