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. styling Slider need help, color on half based on position
Qt 6.11 is out! See what's new in the release blog

styling Slider need help, color on half based on position

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 391 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.
  • C Offline
    C Offline
    cebuger
    wrote on last edited by
    #1

    I want to style the slider similar to this
    3d1ea5e1-c5c4-403e-b458-bc55af2dbd5b-image.png
    wherein the color is different on both halfves of the slider based on the position.

    How do you think i can achieve this?

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

      Hi,

      I think you should be able to do what you want with a stylesheet like:

      QSlider::sub-page
      {
          background: rgb(0, 0, 255);
      }
      
      QSlider::add-page 
      {
          background: rgb(128, 128, 128);
      }
      

      Adjust the color to your liking.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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