Results 1 to 4 of 4

Thread: [Style Sheet] QMenu::item:hover bug

  1. #1
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [Style Sheet] QMenu::item:hover bug

    I have a problem with style sheets with Qt 4.2 on windows. The following code does not produce the wanted effect(see image).
    Qt Code:
    1. app.setStyleSheet(
    2. "QMenu::item:hover {"
    3. " background: RGB(255,238,194);"
    4. " border: 1px solid black;"
    5. "}"
    6. );
    To copy to clipboard, switch view to plain text mode 
    Does anybody know if this has been fixed for version 4.3? And also will 4.3 support "QMenu::item:checked"?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Style Sheet] QMenu::item:hover bug

    What is the desired effect? From what I see your stylesheet is fully respected... The only thing is that you need to set all the needed attributes if you want to use a custom background. And I don't think it's easily avoidable due to a way the XP style works. Using stylesheets causes custom rendering to be enabled which means the xp style is no longer used for your item. Trolltech is surely working on fixing that, but I wouldn't expect a full 'fix' in Qt 4.3. As for now I suggest setting the color and icon position yourself within the stylesheet.

  3. #3
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [Style Sheet] QMenu::item:hover bug

    Well, the desired effect is to change the background of a menu item without losing the foreground. It works for the menu itself. Like for example "QMenu {background: RGB(255,255,255);}".
    I would definitely characterize this as a bug(unwanted feature) and I just wanted to know if some one has tested it with Qt 4.3.

    And by the way, I'm not trying to emulate the Office 2003 look, I just wanted to provide a minimal example. I am going for a comic book look and wanted to know to which extent I can expect to customze the menus.
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Style Sheet] QMenu::item:hover bug

    Quote Originally Posted by spud View Post
    Well, the desired effect is to change the background of a menu item without losing the foreground. It works for the menu itself. Like for example "QMenu {background: RGB(255,255,255);}".
    I would definitely characterize this as a bug(unwanted feature) and I just wanted to know if some one has tested it with Qt 4.3.
    Well, obviously changing the menu background is supported with your widget style whereas changing the item background is not. I'm not saying this is the intended behaviour, but it's certainly not what I'd call a bug. If something is not supported for objective reasons, it's not an error in implementation. For instance I wouldn't call the lack of sound support in Qt a bug

    Does the stylesheet behave the same regardless of the application style you use?

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.