Results 1 to 2 of 2

Thread: Styling background of QScrollBar

  1. #1
    Join Date
    Feb 2010
    Posts
    51
    Thanks
    9
    Thanked 14 Times in 4 Posts

    Default Styling background of QScrollBar

    I'm trying to use stylesheets to style my scrollbars as this picture:


    My problem is to make the background to be just a line with a width of 1px. One idea is to use a picture as the background (where the picture is just white with a 1px line). But is there another way of doing this?

    This is the style I'm using:
    Qt Code:
    1. QScrollBar:vertical {
    2. border: 0px;
    3. background: #fff;
    4. margin: 0px;
    5. width: 15px;
    6. }
    7.  
    8. QScrollBar::handle:vertical {
    9. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
    10. stop: 0 #D7D7D7, stop: 1.0 #A2A2A2);
    11. min-height: 20px;
    12. border: 1px solid #9F9F9F;
    13. border-radius: 4px;
    14. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by martinn; 9th February 2010 at 09:52.

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

    Default Re: Styling background of QScrollBar

    I think you have to either go with a picture or with a linear gradient that will generate a line (but it might not look good if the scrollbar becomes wide because of some reason - like style settings).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Problems styling horizontal QScrollbar
    By GuS in forum Qt Programming
    Replies: 0
    Last Post: 10th September 2008, 22:34
  2. Background Style Disables QScrollBar "Drag" Action
    By brent99 in forum Qt Programming
    Replies: 1
    Last Post: 3rd June 2008, 20:16
  3. qscrollbar styling
    By 20khz in forum Qt Programming
    Replies: 0
    Last Post: 5th May 2008, 14:17
  4. Problems styling QScrollBar / QPushButton
    By December in forum Qt Programming
    Replies: 0
    Last Post: 20th January 2008, 06:53
  5. qss + QScrollBar background issue
    By Lykurg in forum Qt Programming
    Replies: 0
    Last Post: 25th July 2007, 16:17

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.