Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Range Slider Colors
Forum Update on Monday, May 27th 2025

Range Slider Colors

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
8 Posts 3 Posters 2.0k 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
    BadeTech
    wrote on last edited by
    #1

    Hi guys,

    I've done some extensive research through Google to find a method for changing the colors on the range slider and have come up with zilch. Before I go experimenting, I thought I would ask the experts. Is changing the colors even possible? I'm assuming you have to use a style import that's prebuilt into QT, but is there a way to make my own? Thank you for any assistance you can give.

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

      Hi
      Is this QML, you talk about ?

      For QSlider, it supports stylesheet fine.

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

        Yep, it's QML

        mrjjM 1 Reply Last reply
        0
        • B BadeTech

          Yep, it's QML

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @BadeTech
          Ok. give it some time, the QML dudes seems on vacations :)

          B 1 Reply Last reply
          0
          • mrjjM mrjj

            @BadeTech
            Ok. give it some time, the QML dudes seems on vacations :)

            B Offline
            B Offline
            BadeTech
            wrote on last edited by
            #5

            @mrjj

            Ok, so there's no way to change the colors? I'm just making sure before I call this solved

            mrjjM 1 Reply Last reply
            0
            • B BadeTech

              @mrjj

              Ok, so there's no way to change the colors? I'm just making sure before I call this solved

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @BadeTech
              I would give it one more day to see if anyone has idea.

              1 Reply Last reply
              0
              • J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                Hi, I currently don‘t have access to my code base, I‘m on the road. But I have a Range slider with 3 different colors for the 3 sections, before. Value 1 between values and after value 2.

                I‘ll get back to you when I‘m back home, if someone else hasn‘t answered till than.

                Greetings


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                2
                • J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  OK, I'm back :-), and I found the Ranged Slider code:

                  RangeSlider{
                          id: sliderRange
                  
                  	property alias colorSection1: section1.color
                  	property alias colorSection2: section2.color
                  	property alias colorSection3: section3.color
                  
                          background: Rectangle{
                              x: sliderRange.leftPadding
                              y: sliderRange.topPadding + sliderRange.availableHeight/2 - height /2
                              width: sliderRange.availableWidth
                  
                              implicitHeight: 4
                              height: implicitHeight
                              radius: 2
                              color: "#bdbebf"
                  
                              Rectangle{
                                  id: section1
                                  height: parent.height
                                  width: sliderRange.first.visualPosition*parent.width
                              }
                  
                              Rectangle{
                                  id: section2
                                  x: sliderRange.first.visualPosition * parent.width
                                  height: parent.height
                                  width: sliderRange.second.visualPosition*parent.width -x
                              }
                  
                              Rectangle{
                                  id: section3
                                  x: sliderRange.second.visualPosition * parent.width
                                  height: parent.height
                                  width: parent.width -x
                              }
                          }
                      }
                  

                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  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