From 70d413df824a9e46a8f8b43a7cda56a76ed18bcc Mon Sep 17 00:00:00 2001 From: dorian Date: Wed, 27 Mar 2019 22:24:16 +0100 Subject: [PATCH] - added new delegate types which match the look and feel of the app much better than the old ones --- qml/components/SmoothItemDelegate.qml | 30 ++++++++++++++++++++++ qml/components/SmoothSwitchDelegate.qml | 34 +++++++++++++++++++++++++ qml/qml.qrc | 3 ++- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 qml/components/SmoothItemDelegate.qml create mode 100644 qml/components/SmoothSwitchDelegate.qml diff --git a/qml/components/SmoothItemDelegate.qml b/qml/components/SmoothItemDelegate.qml new file mode 100644 index 0000000..cd8fc3c --- /dev/null +++ b/qml/components/SmoothItemDelegate.qml @@ -0,0 +1,30 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.2 + +ItemDelegate { + id: control + text: "" + font.pixelSize: options_stack.text_pixelSize + property color textColor: appTheme.style.textColor + + contentItem: Text { + text: parent.text + color: control.textColor + font.pixelSize: parent.font.pixelSize + } + + width: parent.width + + background: Rectangle { + opacity: enabled ? 1 : 0.3 + color: control.down ? appTheme.style.delegatePressedColor : appTheme.style.delegateBackgroundColor + + radius: height * 0.3 + + Behavior on color { + ColorAnimation { + duration: 200 + } + } + } +} diff --git a/qml/components/SmoothSwitchDelegate.qml b/qml/components/SmoothSwitchDelegate.qml new file mode 100644 index 0000000..61ef88f --- /dev/null +++ b/qml/components/SmoothSwitchDelegate.qml @@ -0,0 +1,34 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.3 + +SwitchDelegate { + id: control + text: qsTr("dark mode") + + contentItem: Text { + text: parent.text + color: appTheme.style.textColor + font.pixelSize: options_stack.text_pixelSize + } + + + width: parent.width + height: parent.delegateHeight + + font.pixelSize: options_stack.text_pixelSize + + indicator: SimpleIndicator{} + + background: Rectangle { + opacity: enabled ? 1 : 0.3 + color: control.down ? appTheme.style.delegatePressedColor : appTheme.style.delegateBackgroundColor + + radius: height * 0.3 + + Behavior on color { + ColorAnimation { + duration: 200 + } + } + } +} diff --git a/qml/qml.qrc b/qml/qml.qrc index 8aec386..3cc214c 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -8,9 +8,10 @@ components/ConnectionDelegate.qml components/FadeAnimation.qml components/ConnectionIcon.qml - SpeedTimer.qml components/NextPageDelegate.qml ErrorDialog.qml components/FancyButton.qml + components/SmoothItemDelegate.qml + components/SmoothSwitchDelegate.qml