Results 1 to 3 of 3

Thread: menu tearoffs/submenus not using stylesheet

  1. #1
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default menu tearoffs/submenus not using stylesheet

    I have customized my menu using a .qss stylesheet like this:

    Qt Code:
    1. {
    2. background-color: #eaeaea;
    3. color: black;
    4. }
    5. QMenu::item::disabled
    6. {
    7. color: rgb(213,213,213);
    8. }
    9. QMenu::separator {
    10. height: 1px;
    11. background: black;
    12. margin-left: 5px;
    13. margin-right: 5px;
    14. }
    To copy to clipboard, switch view to plain text mode 

    This works great for main menus. However one of the menuitems has its own submenu and that is not showing up with any of these properties. I tried doing:
    Qt Code:
    1. QMenu::tear-off
    2. {
    3. background-color: #eaeaea;
    4. color: black;
    5. }
    6. QMenu::tear-off::item::disabled
    7. {
    8. color: rgb(213,213,213);
    9. }
    To copy to clipboard, switch view to plain text mode 

    but that has no effect. Is there a different way to do this?

    Thanks!

  2. #2
    Join Date
    Mar 2010
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: menu tearoffs/submenus not using stylesheet

    use QMenu::tearoff, not tear-off

  3. #3
    Join Date
    Mar 2010
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: menu tearoffs/submenus not using stylesheet

    and you can set styleSheet to the whole app (qApp->setStyleSheet) and it will style all menus you create

Similar Threads

  1. Docked Widget Menu
    By Chuk in forum Qt Programming
    Replies: 6
    Last Post: 3rd July 2013, 14:12
  2. MainWindow Menu bug in Qt 4.2.3?
    By No-Nonsense in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2007, 11:47
  3. Tracking separators in a menu (insertSeparator)
    By PrimeCP in forum Qt Programming
    Replies: 4
    Last Post: 25th January 2006, 18:10

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.