Results 1 to 3 of 3

Thread: QTreewidget stylesheet problem: second column

  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTreewidget stylesheet problem: second column

    I'm facing a problem using stylesheets with QTreeWidget.

    I'm working with Qt 4.7 and these are the stylesheets I'm using, got from:
    http://doc.qt.nokia.com/4.8/stylesheet-examples.html

    Qt Code:
    1. show-decoration-selected: 1;
    2. }
    3.  
    4. QTreeView::item {
    5. border: 1px solid #d9d9d9;
    6. border-top-color: transparent;
    7. border-bottom-color: transparent;
    8. }
    9.  
    10. QTreeView::item:hover {
    11. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
    12. border: 1px solid #bfcde4;
    13. }
    14.  
    15. QTreeView::item:selected {
    16. border: 1px solid #567dbc;
    17. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
    18. }
    19.  
    20. QTreeView::item:selected:active{
    21. border: 1px solid yellow;
    22. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
    23. }
    24.  
    25. QTreeView::item:selected:!active {
    26. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
    27. }
    To copy to clipboard, switch view to plain text mode 

    Everything works fine if I select an item in column 1, but when I click an item in column 2, it's not blue highlighted.
    The only thing you can see are the dots around the item.

    Why ?

  2. #2
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreewidget stylesheet problem: second column SOLVED

    Ok, solved.

    item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);

  3. #3
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreewidget stylesheet problem: second column SOLVED

    I have another problem: when I enable a plugin, it calls:
    Qt Code:
    1. treeWidget->setItemDelegate(itemDelegate);
    To copy to clipboard, switch view to plain text mode 
    and, doing this, the stylesheets of the QTreewidget are lost.

    I've tried to set them again after the plugin has been enabled, but it doesn't work.
    Is it normal ? can I solve the problem ?

Similar Threads

  1. QTreeWidget + StyleSheet problem
    By BlackHornet in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2009, 20:16
  2. QTreeWidget search column
    By mforce2 in forum Newbie
    Replies: 1
    Last Post: 12th April 2009, 20:52
  3. QTreeWidget - How to get a column text ?
    By fabriciols in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2008, 16:32
  4. QTreeWidget scroll only one column
    By nina1983 in forum Qt Programming
    Replies: 3
    Last Post: 13th August 2008, 15:07
  5. set Column Width in QTreeWidget?
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2007, 08:12

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.