Results 1 to 1 of 1

Thread: Need a check box inside QTableView

  1. #1
    Join Date
    Oct 2013
    Posts
    102
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Need a check box inside QTableView

    Hi.

    I have a simple QTableView displaying data from QStandardItemModel, but now I need one column to be like a check box and not ordinary text. How would I acchieve that? Do I have to create/extend new class from QTableView, or can that be controled via QStandardItemModel somehow? A simple snippet of code would be very useful, much thanks.


    Added after 9 minutes:


    I've googled it out and looks ok.
    Qt Code:
    1. QStandardItem *stItem3 = new QStandardItem(true);
    2. stItem3->setCheckable(true);
    3. //stItem3->setCheckState(Qt::Unchecked);
    4. stItem3->setCheckState(Qt::Checked);
    To copy to clipboard, switch view to plain text mode 
    Last edited by arcull; 28th August 2015 at 07:21.

Similar Threads

  1. Replies: 1
    Last Post: 6th December 2013, 21:08
  2. how to add check box inside qtree widget?
    By aurora in forum Qt Programming
    Replies: 4
    Last Post: 25th May 2012, 02:16
  3. QTreeView inside QTableView
    By y.s.bisht in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2012, 11:28
  4. Replies: 0
    Last Post: 17th October 2011, 22:16
  5. Check a point inside or outside a road?
    By kstking in forum Qt Programming
    Replies: 1
    Last Post: 15th October 2007, 19:48

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.