Skip to content

Instantly share code, notes, and snippets.

@ttv20
Created May 18, 2017 20:41
Show Gist options
  • Save ttv20/7c4d23138ab847ccd78e6e4381a0e30d to your computer and use it in GitHub Desktop.
Save ttv20/7c4d23138ab847ccd78e6e4381a0e30d to your computer and use it in GitHub Desktop.
import QtQuick 2.2
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.4
Item {
width: 500
height: 500
LayoutMirroring.enabled: true
LayoutMirroring.childrenInherit: true
Column {
spacing: 12
anchors.centerIn: parent
Slider {
anchors.margins: 20
value: 0
}
Slider {
anchors.margins: 20
value: 0.5
}
Slider {
anchors.margins: 20
style: breeze
value: 1
}
}
// COPY FROM Breeze source code
Component {
id: breeze
SliderStyle {
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
groove: Rectangle {
opacity: control.enabled ? 1.0 : 0.5
id: control
anchors.centerIn: parent
implicitWidth: 300
implicitHeight: 16
color: "transparent"
Rectangle {
anchors.fill: parent
anchors.margins: 5
color: ColorUtils.adjustAlpha(sysPalette.windowText, 0.3)
radius: 3
}
Rectangle {
id: grooveFill
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.margins: 5
width: styleData.handlePosition
height:6
color: sysPalette.highlight
radius: 3
}
}
handle: Item {
property color borderColor: ColorUtils.blendColors(sysPalette.windowText, sysPalette.window, 0.75)
implicitWidth: 20
implicitHeight: 20
Rectangle {
visible: control.enabled
anchors.centerIn: parent
height: 20
width: 20
radius: 10
color: ColorUtils.adjustAlpha(sysPalette.shadow, 0.15)
}
Rectangle {
id: sHandle
anchors.centerIn: parent
height: 20
width: 20
radius: 10
border.width: control.activeFocus ? 2 : 1
border.color: (control.activeFocus || control.hovered || control.pressed) ? sysPalette.highlight : borderColor
color: sysPalette.button
transform: Translate {x: control.pressed ? 0 : -1; y: control.pressed ? 0 : -1}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment