diff options
author | Jedi18 <targetakhil@gmail.com> | 2021-02-13 23:59:42 +0530 |
---|---|---|
committer | Jedi18 <targetakhil@gmail.com> | 2021-02-13 23:59:42 +0530 |
commit | 1a406f79e6c7f673172c07da30ab958e980d919c (patch) | |
tree | 7f49a3ac1c0593aa672ab2230e0ec8034a26faa1 /resources/qml/ToggleButton.qml | |
parent | 4996ae27a0f8cf2a9e2c3834cee3e546239a486a (diff) |
replaced with togglebutton using qtquickcontrols2
Diffstat (limited to 'resources/qml/ToggleButton.qml')
-rw-r--r-- | resources/qml/ToggleButton.qml | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/resources/qml/ToggleButton.qml b/resources/qml/ToggleButton.qml index cf67c48c..01aef4c6 100644 --- a/resources/qml/ToggleButton.qml +++ b/resources/qml/ToggleButton.qml @@ -1,22 +1,32 @@ import QtQuick 2.5 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick 2.12 +import QtQuick.Controls 2.12 import im.nheko 1.0 Switch { - style: SwitchStyle { - handle: Rectangle { - width: 20 - height: 20 - radius: 90 - color: "whitesmoke" + id: toggleButton + + indicator: Item { + implicitWidth: 48 + implicitHeight: 26 + + Rectangle { + height: parent.height/2 + radius: height/2 + width: parent.width - height + x: radius + y: parent.height / 2 - height / 2 + color: toggleButton.checked ? "skyblue" : "grey" + border.color: "#cccccc" } - groove: Rectangle { - implicitWidth: 40 - implicitHeight: 20 - radius: 90 - color: checked ? "skyblue" : "grey" + Rectangle { + x: toggleButton.checked ? parent.width - width : 0 + width: parent.height + height: width + radius: width/2 + color: toggleButton.down ? "whitesmoke" : "whitesmoke" + border.color: "#999999" } } }
\ No newline at end of file |