Results 1 to 1 of 1

Thread: QTableWidget row selection

  1. #1
    Join Date
    Jul 2008
    Location
    Munich
    Posts
    73
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget row selection

    I have a QTableWidget which provides multi-row-selection property. Now new requirement is that partial rows should be grayed out, and the user can not select them.

    For QTableWidget, I set:
    Qt Code:
    1. ui.tableWidget->setSelectionMode(QAbstractItemView::MultiSelection);
    2. ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    To copy to clipboard, switch view to plain text mode 

    How could I disable the selection of certain rows of this table? Thanks in advance.


    Added after 11 minutes:


    Ha, I found the answer:
    QTableWidgetItem::setFlags(Qt::NoItemFlags) solves my problem!
    Last edited by stella1016; 23rd March 2012 at 12:52.

Similar Threads

  1. QTableWidget - items selection
    By trallallero in forum Qt Programming
    Replies: 1
    Last Post: 10th November 2011, 13:03
  2. Deselecting selection on QTableWidget
    By grantbj74 in forum Newbie
    Replies: 3
    Last Post: 27th May 2010, 04:28
  3. QTableWidget row selection
    By BingoMaster in forum Newbie
    Replies: 5
    Last Post: 17th October 2009, 22:39
  4. QTableWidget, selection problem
    By stella1016 in forum Qt Programming
    Replies: 2
    Last Post: 6th October 2009, 15:49
  5. Selection in QTableWidget
    By Nippler in forum Qt Programming
    Replies: 3
    Last Post: 30th April 2008, 08:32

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.