Results 1 to 3 of 3

Thread: styling focus rect in QTreeView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: styling focus rect in QTreeView

    Quote Originally Posted by roxton View Post
    Is there a way to change the view of focus rect (dotted) around the active row?
    Yes.
    but I cannot find how to do that right.
    Either have a custom delegate or use style-sheets.

    item:selected:active is not the solution because I have many items selected and the "current cursor position" is the current item (currentIndex()) that is not selected by default in my QTreeView subclass.
    That's ::item:active, isn't it?
    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.


  2. The following 2 users say thank you to wysota for this useful post:

    maverick (31st May 2013)

  3. #2
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: styling focus rect in QTreeView

    Quote Originally Posted by wysota View Post
    That's ::item:active, isn't it?
    Unfortunately, item:active affects all rows in QTreeView (I don't know why its happen). For example:

    MyTreeView::item:active {background-color: blue;}

    With such style, all rows will have blue background, and current row has the default white background.
    So, as you suggets, I will look to the item delegation.

  4. The following user says thank you to roxton for this useful post:


Similar Threads

  1. styling controls inside QTreeView
    By mentalmushroom in forum Qt Programming
    Replies: 2
    Last Post: 27th May 2011, 18:25
  2. Replies: 0
    Last Post: 1st November 2010, 08:22
  3. QTreeView does not get focus on S60
    By hubbobubbo in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st June 2010, 14:44
  4. Replies: 2
    Last Post: 2nd November 2009, 13:24
  5. Focus rect not drawing
    By draftpunk in forum Qt Programming
    Replies: 3
    Last Post: 11th November 2008, 15:21

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
  •  
Qt is a trademark of The Qt Company.