Results 1 to 2 of 2

Thread: QScrollBar changing width on the handle

  1. #1
    Join Date
    Jun 2014
    Posts
    2

    Default QScrollBar changing width on the handle

    I am using a style sheet to customize a QScrollBar for QTextEdit. It is almost looking how I want, but I have run into an odd bug: two different instances of the textedit have different widths on the scrollbar's handle. This doesn't make sense to me because the two textedits have the exact same stylesheet for the scrollbar. Here's an image:

    qscrollbarbug.png

    As you can see, the handle is thinner in one, fatter in another. I've tried setting a width for the handle in the stylesheet, but it didn't have an effect.

    Does anyone know what could be changing the handle width?

    Here's my stylesheet code, for reference:
    Qt Code:
    1. pCustomScroll->setStyleSheet(
    2. "QScrollBar:vertical {"
    3. "background: rgb(63, 63, 63);"
    4. "width: 22px;"
    5. "margin: 22px 0 22px 0;"
    6. "}"
    7. "QScrollBar::handle:vertical {"
    8. "border: 1px rgb(63, 63, 63);"
    9. "border-radius: 3px;"
    10. "background: rgb( 63, 63, 63 );"
    11. "}"
    12. "QScrollBar::add-line:vertical {"
    13. "background: white;"
    14. "height: 22px;"
    15. "subcontrol-position: bottom;"
    16. "subcontrol-origin: margin;"
    17. "}"
    18. "QScrollBar::sub-line:vertical {"
    19. "background: white;"
    20. "height: 22px;"
    21. "subcontrol-position: top;"
    22. "subcontrol-origin: margin;"
    23. "}"
    24. "QScrollBar::up-arrow:vertical {"
    25. "border-image: url(:/Icons/Resources/Icons/LargeUpArrow.png);"
    26. "}"
    27. "QScrollBar::down-arrow:vertical {"
    28. "border-image: url(:/Icons/Resources/Icons/LargeDnArrow.png);"
    29. "}"
    30. "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {"
    31. "background: white;"
    32. "}" );
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2014
    Posts
    18
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: QScrollBar changing width on the handle

    Hi,

    could it be, that the width of your QTextEdit with the smaller scrollBar is smaller than the width of the other QtextEdit? Maybe it has something to do with the sizePolicy?

Similar Threads

  1. QSlider: changing the groove without changing the handle
    By Olivier Berten in forum Qt Programming
    Replies: 3
    Last Post: 30th April 2013, 10:02
  2. Problem styling QScrollBar::handle
    By kerchen in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2012, 18:06
  3. Replies: 0
    Last Post: 11th December 2010, 00:01
  4. QScrollbar handle stretch problem
    By Beppe in forum Qt Programming
    Replies: 4
    Last Post: 30th July 2009, 12:58
  5. Custom (pixmap) slider handle for QScrollBar
    By Antrax in forum Qt Programming
    Replies: 1
    Last Post: 17th October 2006, 11:04

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.