Simple way to change QML slider background color?
-
wrote on 26 Dec 2018, 20:35 last edited by
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.
-
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.
@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
-
wrote on 27 Dec 2018, 13:04 last edited by
Yeap, I see it setting x and y there, along with implicit sizes, thank you much sir.
1/3