Results 1 to 2 of 2

Thread: QTreeWidget and Selected Item

  1. #1
    Join Date
    Dec 2014
    Posts
    49
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5 PyQt3 PyQt4
    Platforms
    Windows

    Default QTreeWidget and Selected Item

    I have a QTreeWidget with a few QTreeWidgetItems in it. Each QTreeWidgetItem has a custom editor that is attached using setItemWidget(...). I have modified my style sheet as follows

    Qt Code:
    1. QTreeWidget::item:selected:active{
    2. background-color: transparent;
    3. color: #3d80df;
    4. }
    5.  
    6. QTreeWidget::item:selected:!active {
    7. background-color: transparent;
    8. color: #3d80df;
    9. }
    To copy to clipboard, switch view to plain text mode 

    so that when an item is selected, the color turns blue. However, the widget that is in column 1 that was set with setItemWidget is not showing a selected state.

    What property in the style sheet do i need to modify, or how can i achieve this functionality.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeWidget and Selected Item

    Does it work for column 2? Anyway, widgets you set with setIndexWidget are not related to items so styling items has no influence on widgets.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 21st October 2013, 09:16
  2. popupmenu for QTreeWidget's item when a particular item selected.
    By vinod sharma in forum Best Practices in Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 10:45
  3. Replies: 1
    Last Post: 20th January 2010, 08:38
  4. Replies: 2
    Last Post: 26th January 2008, 10:20
  5. QListWidget/QTreeWidget, etc selected item color
    By Arthur in forum Qt Programming
    Replies: 4
    Last Post: 15th May 2006, 16:50

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.