Skip to content

Commit 2e8b096

Browse files
committed
qml: Add DropShadow to the OptionSwitch indicatorButton
- This commit is a follow-up to PR#101 (c026a3e). - This addresses the suggestions given on this PR after it was merged. - This commit also adds the DropShadow for the OptionSwitch's indicatorButton, as per the official design scheme of the project.
1 parent ef98ffa commit 2e8b096

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

src/qml/components/ConnectionSettings.qml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ ColumnLayout {
1111
spacing: 20
1212
Setting {
1313
Layout.fillWidth: true
14-
header: "Use cellular data"
14+
header: qsTr("Use cellular data")
1515
}
1616
Setting {
1717
Layout.fillWidth: true
18-
header: "Daily upload limit"
18+
header: qsTr("Daily upload limit")
1919
}
2020
Setting {
2121
Layout.fillWidth: true
22-
header: "Connection limit"
22+
header: qsTr("Connection limit")
2323
}
2424
Setting {
2525
Layout.fillWidth: true
26-
header: "Listening enabled"
27-
description: "Reduces data usage."
26+
header: qsTr("Listening enabled")
27+
description: qsTr("Reduces data usage.")
2828
}
2929
Setting {
3030
last: true
3131
Layout.fillWidth: true
32-
header: "Blocks Only"
33-
description: "Do not transfer unconfirmed transactions. Also disabled listening."
32+
header: qsTr("Blocks Only")
33+
description: qsTr("Do not transfer unconfirmed transactions. Also disabled listening.")
3434
}
3535
}

src/qml/controls/OptionSwitch.qml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
7+
import QtGraphicalEffects 1.15
78

89
Switch {
910
id: root
1011
indicator: Rectangle {
1112
implicitWidth: 45
1213
implicitHeight: 28
1314
x: root.leftPadding
14-
y: parent.height / 2 - height / 2
15+
y: Math.round((parent.height - height) / 2)
1516
radius: 18
1617
color: root.checked ? "#F7931A" : "#DDDDDD"
1718
Rectangle {
@@ -23,5 +24,16 @@ Switch {
2324
radius: 18
2425
color: "#ffffff"
2526
}
27+
28+
DropShadow {
29+
anchors.fill: indicatorButton
30+
horizontalOffset: 0
31+
verticalOffset: 5
32+
radius: 10.0
33+
spread: 0.0
34+
samples: 21
35+
color: "#00000040"
36+
source: indicatorButton
37+
}
2638
}
2739
}

src/qml/controls/Setting.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import QtQuick.Layouts 1.15
88

99
Control {
1010
id: root
11-
property bool last: false
12-
property string header
11+
property bool last: parent && root === parent.children[parent.children.length - 1]
12+
required property string header
1313
property string description
1414
contentItem: GridLayout {
1515
columns: 2

0 commit comments

Comments
 (0)