Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting slider width in QScrollBar

Setting slider width in QScrollBar

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 487 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    burrito85
    wrote on last edited by
    #1

    Hello,

    i am using Qt Creator 4.5.2 (Qt 5.9.5) and want to change the width of the slider in a vertical QScrollBar (QScrollArea), because of the narrow design (5 px). So, i played around with parameters verticalScrollBar()->setFixedWidth(40) / verticalScrollBar()->setMinimum(40) / verticalScrollBar()->setMaximum(40) / verticalScrollBar()->setStyleSheet("QScrollBar::vertical{width:40px;}") but nothing worked.

    I can change the slider length, but not the width. What am i doing wrong?

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      add margins to the handle in the stylesheet
      "QScrollBar::handle:vertical{border: none; margin: *px *px *px *px; }"

      1 Reply Last reply
      0
      • B Offline
        B Offline
        burrito85
        wrote on last edited by
        #3

        Thank you, that works. But is there a way without stylesheets, because it does affect other visual parameters too and i do not know how to avoid that?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved