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. Simple way to change QML slider background color?

Simple way to change QML slider background color?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 3.0k 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
    MrShawn
    wrote on last edited by
    #1

    import QtQuick.Controls 2.4

    is the version I am using.

    The default gray blends too much with my background color of the page and I would like to change the undragged portion to black and the dragged portion to some other color like green.

    Is there is a simple approach to setting the background colors?

    I found this but it seems a little overcomplicated, or at the very least I am having trouble working out the positioning.

    Here is the relevant snippet from that link:

    background: Rectangle {
            y: (control.height - height) / 2
            height: 4
            radius: 2
            color: UIStyle.colorQtGray3
    
            Rectangle {
                width: control.visualPosition * parent.width
                height: parent.height
                color: UIStyle.colorQtAuxGreen2
                radius: 2
            }
        }
    

    When I start to implement this code I am unable to properly position my slider.

    raven-worxR 1 Reply Last reply
    0
    • M MrShawn

      import QtQuick.Controls 2.4

      is the version I am using.

      The default gray blends too much with my background color of the page and I would like to change the undragged portion to black and the dragged portion to some other color like green.

      Is there is a simple approach to setting the background colors?

      I found this but it seems a little overcomplicated, or at the very least I am having trouble working out the positioning.

      Here is the relevant snippet from that link:

      background: Rectangle {
              y: (control.height - height) / 2
              height: 4
              radius: 2
              color: UIStyle.colorQtGray3
      
              Rectangle {
                  width: control.visualPosition * parent.width
                  height: parent.height
                  color: UIStyle.colorQtAuxGreen2
                  radius: 2
              }
          }
      

      When I start to implement this code I am unable to properly position my slider.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @MrShawn said in Simple way to change QML slider background color?:

      When I start to implement this code I am unable to properly position my slider.

      see this

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • M Offline
        M Offline
        MrShawn
        wrote on last edited by
        #3

        Yeap, I see it setting x and y there, along with implicit sizes, thank you much sir.

        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