Results 1 to 1 of 1

Thread: How to prevent QTreeView::item border styles from ruining item selected style?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default How to prevent QTreeView::item border styles from ruining item selected style?

    I'm creating a property editor widget based on a QTreeView and would like to add horizontal/vertical lines to separate rows and columns. I attempted to set the following stylesheet on the QTreeView:

    Qt Code:
    1. QTreeView:item {
    2. border-right: 1px solid #d9d9d9;
    3. border-bottom: 1px solid #d9d9d9;
    4. }
    5. QTreeView::branch {
    6. border-bottom: 1px solid #d9d9d9;
    7. }
    To copy to clipboard, switch view to plain text mode 

    The grid appears as expected but selected items aren't highlighted in blue anymore. Furthermore, the [+] symbol to expand a group appears to be gone.

    Before:

    GAp95.png

    After:

    Sa7OG.png

    If there is any method other than setting the stylesheet to achieve the same result, I'd be glad to hear about them. I tried the QStyledItemDelegate method but unfortunately, the horizontal lines do not cover the "branch" region.

    Thanks for your help.
    Last edited by pmjobin; 25th January 2015 at 08:30.

Similar Threads

  1. Replies: 2
    Last Post: 25th December 2014, 14:27
  2. How to keep selected item in QTreeView
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 19th July 2011, 06:16
  3. Replies: 2
    Last Post: 17th February 2011, 03:55
  4. Changing selected QTreeView item font
    By dima1000 in forum Newbie
    Replies: 5
    Last Post: 8th October 2009, 10:28
  5. QTreeView: selection behavior upon selected item removal
    By Pieter from Belgium in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2007, 17:00

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.