Results 1 to 2 of 2

Thread: QTreeWidget context menu style

  1. #1
    Join Date
    Apr 2012
    Posts
    43
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default QTreeWidget context menu style

    Hi. How to set style for context menu in QTreeWidget. I have application with top menu containing come QActions and want some of theese actions appear when I rightclick inside QTreeWidget.

    Qt Code:
    1. myTree.setStyleSheet("QWidget {background-color: #fcfcfc}");
    To copy to clipboard, switch view to plain text mode 

    Does the trick setting background of context menu, but also sets background for QTreeWidget itself and that I dont want. How to set style for context menu only? Is there some myTree.setStyleSheet("QWidget:contextMenu {background-color: #fcfcfc}");?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidget context menu style

    there some myTree.setStyleSheet("QWidget:contextMenu {background-color: #fcfcfc}");?
    Why not read the docs?
    http://qt-project.org/doc/qt-4.8/sty...tomizing-qmenu
    http://qt-project.org/doc/qt-4.8/sty...reference.html
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Qt Context menu
    By jeyanthinatarajan in forum Newbie
    Replies: 3
    Last Post: 4th April 2012, 22:26
  2. Replies: 1
    Last Post: 4th November 2011, 11:25
  3. Tab keeps hover style after a context menu is closed
    By gui developer in forum Newbie
    Replies: 1
    Last Post: 29th September 2010, 01:44
  4. Context menu
    By dejvis in forum Newbie
    Replies: 2
    Last Post: 20th September 2009, 22:02
  5. QTreeWidget Context Menu
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2007, 11:24

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.