Results 1 to 2 of 2

Thread: Styling QComoBox using CSS Stylesheet

  1. #1
    Join Date
    Jan 2007
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Styling QComoBox using CSS Stylesheet

    Hello everyone,

    I've got a very strange problem. I'm trying to style a QComboBox using a stylesheet that looks like this:

    Qt Code:
    1. border: 1px solid #333333;
    2. border-radius: 3px;
    3. background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #797979, stop:0.48 #696969, stop:0.52 #5e5e5e, stop:1 #4f4f4f);
    4. padding: 1px 23px 1px 3px;
    5. min-width: 6em;
    6. color: #ffffff;
    7. }
    8. QComboBox::drop-down {
    9. subcontrol-origin: padding;
    10. subcontrol-position: top right;
    11. width: 20px;
    12.  
    13. border-top-right-radius: 3px;
    14. border-bottom-right-radius: 3px;
    15. }
    16. QComboBox::down-arrow {
    17. image: url(:/images/combobox-arrow.png);
    18. }
    19.  
    20. QComboBox QAbstractView{
    21. background-color: #4f4f4f;
    22. color: #999999;
    23.  
    24. selection-background-color: #999999;
    25. selection-color: #4f4f4f;
    26. }
    To copy to clipboard, switch view to plain text mode 

    The Combobox looks very nice as long as I don't press it. The Menu, that pops up then is totally messed up - it's got completely black background and an ugly border. Nothing I do seems to change this much.

    I also tried to use the exact stylesheet that trolltech gives as an example for styling a combobox, but that results in the same problem.

    I hope someone can help me. I'm on a Mac here if that makes a difference (shouldnt, but might )

    Thanks in advance for any help!

    Björn

  2. #2
    Join Date
    Jan 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Styling QComoBox using CSS Stylesheet

    It's not QAbstractView. It's QAbstractItemView.

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.