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. Changing the color of the handle of a vertical QSlider looses the shape and the other states

Changing the color of the handle of a vertical QSlider looses the shape and the other states

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    maria.v
    wrote on last edited by
    #1

    This is the normal behavior of the handle of the slider

    Normal:
    normal.png
    Hover:
    hover.png
    Disable:
    disable_or_pressed.png !

    I want this but change the blue color for rgb(72, 66, 66) .

    I tried to change the blue color like this

    QSlider::handle:vertical {
    	height: 4px;
    	background-color: rgb(72, 66, 66);
     	margin: 0 -4px; /* expand outside the groove */
    	border-radius: 8px;
    	width: 8px;
    }
    

    But it looses the shape and looses the hover and disable state. It always looks like this

    result_of_changing_color.png

    How can I change the color without loosing the shape and the other states?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Stylesheets are all or nothing.
      As soon as you apply a stylesheet to a widget, the normal drawing is
      no longer in effect/changes.

      So you have to style all of it. including the shape to look like it used to
      and hover effects.

      QSlider::handle:vertical:hover {
      background-color: rgb(...);
      }

      So thats one of the downsides with stylesheets.

      1 Reply Last reply
      2

      • Login

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