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