2021-02-10 18:52:42 +03:00
|
|
|
import QtQuick 2.5
|
2021-02-13 21:29:42 +03:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
2021-02-10 18:52:42 +03:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
|
|
|
Switch {
|
2021-02-13 21:29:42 +03:00
|
|
|
id: toggleButton
|
2021-02-20 04:53:14 +03:00
|
|
|
|
2021-02-16 19:52:55 +03:00
|
|
|
implicitWidth: indicatorItem.width
|
2021-02-13 21:29:42 +03:00
|
|
|
|
2021-02-20 04:53:14 +03:00
|
|
|
indicator: Item {
|
2021-02-16 19:52:55 +03:00
|
|
|
id: indicatorItem
|
2021-02-20 04:53:14 +03:00
|
|
|
|
2021-02-13 21:29:42 +03:00
|
|
|
implicitWidth: 48
|
2021-02-16 09:22:03 +03:00
|
|
|
implicitHeight: 24
|
|
|
|
y: parent.height / 2 - height / 2
|
2021-02-13 21:29:42 +03:00
|
|
|
|
|
|
|
Rectangle {
|
2021-02-20 04:53:14 +03:00
|
|
|
height: 3 * parent.height / 4
|
|
|
|
radius: height / 2
|
2021-02-13 21:29:42 +03:00
|
|
|
width: parent.width - height
|
|
|
|
x: radius
|
|
|
|
y: parent.height / 2 - height / 2
|
|
|
|
color: toggleButton.checked ? "skyblue" : "grey"
|
|
|
|
border.color: "#cccccc"
|
2021-02-13 19:19:21 +03:00
|
|
|
}
|
2021-02-20 04:53:14 +03:00
|
|
|
|
2021-02-13 21:29:42 +03:00
|
|
|
Rectangle {
|
|
|
|
x: toggleButton.checked ? parent.width - width : 0
|
2021-02-16 09:22:03 +03:00
|
|
|
y: parent.height / 2 - height / 2
|
2021-02-13 21:29:42 +03:00
|
|
|
width: parent.height
|
|
|
|
height: width
|
2021-02-20 04:53:14 +03:00
|
|
|
radius: width / 2
|
2021-02-13 21:29:42 +03:00
|
|
|
color: toggleButton.down ? "whitesmoke" : "whitesmoke"
|
2021-02-16 09:22:03 +03:00
|
|
|
border.color: "#ebebeb"
|
2021-02-13 19:19:21 +03:00
|
|
|
}
|
2021-02-20 04:53:14 +03:00
|
|
|
|
2021-02-13 19:19:21 +03:00
|
|
|
}
|
2021-02-20 04:53:14 +03:00
|
|
|
|
|
|
|
}
|