opaque/ToggleSwitch.qml

27 lines
667 B
QML
Raw Normal View History

2020-05-19 19:49:52 +00:00
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick 2.12
2020-05-19 20:25:56 +00:00
import "theme"
2020-05-19 19:49:52 +00:00
2020-12-17 01:34:15 +00:00
// ToggleSwtch implements a stylized toggle switch.
2020-05-19 19:49:52 +00:00
Switch {
style: SwitchStyle {
handle: Rectangle {
implicitWidth: 25
implicitHeight: 25
radius: width*0.5
color: Theme.toggleColor
2020-12-15 01:16:49 +00:00
border.color: checked ? Theme.toggleOnColor :Theme.toggleOffColor
2020-05-19 19:49:52 +00:00
border.width:5
}
groove: Rectangle {
implicitWidth: 50
implicitHeight: 25
radius: 25*0.5
2020-12-15 01:16:49 +00:00
color: checked ? Theme.toggleOnColor :Theme.toggleOffColor
2020-05-19 19:49:52 +00:00
}
}
}