Results 1 to 6 of 6

Thread: Scrollbar background does not go solid (?) when using stylesheets

  1. #1
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Scrollbar background does not go solid (?) when using stylesheets

    As shown in the image attached, the following code gives me a scrollbar with a dotted background. I would like to make that background solid, but I can't seem to make Qt do that using the stylesheet mechanism.

    I was wondering if someone knows if this is either a bug, if it's supposed to work like this or if there's a work-around.

    I'm using Windows Vista, if that matters (I've noticed some other different behaviors as well, using Vista and Qt styles, that's why I mention it).

    Qt Code:
    1. QScrollBar:horizontal {
    2. background-color: blue;
    3. border: 1px solid black;
    4. margin: 0px 16px 0px 16px;
    5. }
    6.  
    7. QScrollBar::handle:horizontal {
    8. background: red;
    9. border: 1px solid yellow;
    10. }
    11.  
    12. QScrollBar::add-line:horizontal {
    13. border: 1px solid black;
    14. background: purple;
    15. width: 16px;
    16. subcontrol-position: right;
    17. subcontrol-origin: margin;
    18. }
    19.  
    20. QScrollBar::sub-line:horizontal {
    21. border: 1px solid black;
    22. background: purple;
    23. width: 16px;
    24. subcontrol-position: left;
    25. subcontrol-origin: margin;
    26. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Scrollbar background does not go solid (?) when using stylesheets

    What if you preview it in a different style, like plastique?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Scrollbar background does not go solid (?) when using stylesheets

    Interesting! I didn't test all styles because I assumed they would all give the same results after I tried a few, but it appears that both the Motif and CDE styles are the only styles with correct and solid colored backgrounds for the scrollbar. The rest don't (Windows, Windows XP, Windows Vista, Cleanlooks, Plastique, ..)

    I guess we're looking at a bug here?
    (I'm using the snapshot from March 19th, by the way)
    Last edited by Stukfruit; 19th March 2008 at 21:35.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Scrollbar background does not go solid (?) when using stylesheets

    Quote Originally Posted by Stukfruit View Post
    I guess we're looking at a bug here?
    (I'm using the snapshot from March 19th, by the way)
    I guess so, I suggest you send your findings at Qt4-preview-feedback Mailing List.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    Stukfruit (20th March 2008)

  6. #5
    Join Date
    Jun 2010
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: Scrollbar background does not go solid (?) when using stylesheets

    did this ever get fixed, or is there a workaround ?

    cheers

    rob.

  7. #6
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Scrollbar background does not go solid (?) when using stylesheets

    I had the same problem lately. Solution is simple, just add this line to stylesheet:

    Qt Code:
    1. QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
    2. background: none;
    3. }
    To copy to clipboard, switch view to plain text mode 

    cheers

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.