From e77b2bf658816de16c29d057857994d95927baa3 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 20 Mar 2018 20:47:24 +0100 Subject: [PATCH] use external checkbox image --- bin/win64/res/qml/.gitignore | 1 + bin/win64/res/qml/MyToggleButton.qml | 27 +++++++++++++++++++-------- bin/win64/res/qml/check.svg | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 bin/win64/res/qml/.gitignore create mode 100644 bin/win64/res/qml/check.svg diff --git a/bin/win64/res/qml/.gitignore b/bin/win64/res/qml/.gitignore new file mode 100644 index 0000000..86950b3 --- /dev/null +++ b/bin/win64/res/qml/.gitignore @@ -0,0 +1 @@ +*.qmlc diff --git a/bin/win64/res/qml/MyToggleButton.qml b/bin/win64/res/qml/MyToggleButton.qml index 85629b6..0dd6961 100644 --- a/bin/win64/res/qml/MyToggleButton.qml +++ b/bin/win64/res/qml/MyToggleButton.qml @@ -4,22 +4,33 @@ import "." // QTBUG-34418, singletons require explicit import to load qmldir fil CheckBox { - hoverEnabled: true - spacing: 12 + checkState: Qt.Checked + tristate: false + hoverEnabled: true + spacing: 12 indicator: Rectangle { implicitWidth: 28 implicitHeight: 28 x: parent.leftPadding y: parent.height / 2 - height / 2 - color: parent.enabled ? (parent.down ? "#e0e0e0" : "#ffffff") : "#a0a0a0" - border.width: 0 + color: parent.enabled ? (parent.down ? "#e0e0e0" : "#ffffff") : "#a0a0a0" + border.width: 0 + Path { + startX: 0 + startY: 0 + PathLine { + x: 40 + y: 40 + } + } + Image { - width: 38 - height: 38 + width: 28 + height: 28 x: (parent.width - width) / 2 y: (parent.height - height) / 2 - source: "image://default/check/#2c435d" + source: "check.svg" sourceSize.width: width sourceSize.height: height visible: parent.parent.checked @@ -36,7 +47,7 @@ CheckBox { background: Rectangle { color: "#2c435d" - opacity: parent.activeFocus ? 1.0 : 0.0 + opacity: parent.activeFocus ? 1.0 : 0 } onHoveredChanged: { diff --git a/bin/win64/res/qml/check.svg b/bin/win64/res/qml/check.svg new file mode 100644 index 0000000..6a6f37f --- /dev/null +++ b/bin/win64/res/qml/check.svg @@ -0,0 +1 @@ + \ No newline at end of file