Results 1 to 3 of 3

Thread: QTreeWidget setCurrentItem difference height with the same setStyleSheet

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QTreeWidget setCurrentItem difference height with the same setStyleSheet

    That's pretty strange. I tried setting the style sheet in the MainWindow ctor and it seems to work:
    Qt Code:
    1. ui->treeWidget->setStyleSheet("::item { margin-top:2; margin-bottom:2; min-height:20;} "
    2. "::item:selected:!active { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, "
    3. "stop: 0 rgb(255,211,159), stop: 0.4 rgb(254,180,72), stop: 1 rgb(254,222,119));}"
    4. "::item:selected:active { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, "
    5. "stop: 0 rgb(66,180,255), stop: 1 rgb(0,152,255)); }"
    6. "::item:hover { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, "
    7. "stop: 0 rgb(247,235,224), stop: 1 rgb(255,211,159));}");
    To copy to clipboard, switch view to plain text mode 
    Didn't get any warnings but maybe there is a problem parsing your css file.

    Edit: I quit reading and tried your code before getting to case 3.
    Last edited by norobro; 18th January 2011 at 05:38. Reason: added comment

Similar Threads

  1. QToolButton & setStyleSheet
    By kavinsiva in forum Newbie
    Replies: 1
    Last Post: 3rd June 2010, 14:52
  2. Replies: 1
    Last Post: 21st November 2008, 16:06
  3. Problem to setstylesheet
    By phillip_Qt in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2008, 06:57
  4. using setStyleSheet
    By Weilor in forum Qt Programming
    Replies: 11
    Last Post: 18th January 2008, 13:41
  5. Replies: 2
    Last Post: 6th April 2006, 08:21

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.