Results 1 to 2 of 2

Thread: QTreewidget : Highligth only one item when select a row

  1. #1
    Join Date
    May 2012
    Posts
    1

    Default QTreewidget : Highligth only one item when select a row

    Hello,

    I use a QTreewidget with 4 columns and when I select a row, i don't want the entire row to be highlighted, but only the item in column 1 (even if I select the row by clicking on another column). I don't find how to do this.

    Thanks for your help
    Last edited by KraCk; 29th May 2012 at 16:47.

  2. #2
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreewidget : Highligth only one item when select a row

    Try reimplement mousePressEvent.
    Qt Code:
    1. void TreeWidget::mousePressEvent( QMouseEvent *e )
    2. {
    3. selectionModel()->setCurrentIndex( indexAt( e->pos() ), QItemSelectionModel::ClearAndSelect );
    4. QTreeWidget::mousePressEvent(e);
    5. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QListView - To select a disabled item
    By agarny in forum Qt Programming
    Replies: 3
    Last Post: 10th July 2011, 01:23
  2. can't select item in a QTreeWidget via code
    By zack in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2009, 20:31
  3. QTreeWidget select item
    By ^NyAw^ in forum Qt Programming
    Replies: 7
    Last Post: 26th October 2007, 14:26
  4. Cannot select an item in QComboBox
    By Declan in forum Qt Programming
    Replies: 2
    Last Post: 19th April 2007, 08:08
  5. [QComboBox] (pre-)select no item. (solved)
    By lauranger in forum Qt Programming
    Replies: 4
    Last Post: 17th July 2006, 13:26

Tags for this Thread

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.