aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrating89us <45968869+rating89us@users.noreply.github.com>2021-12-07 23:49:35 +0100
committerrating89us <45968869+rating89us@users.noreply.github.com>2021-12-08 13:00:10 +0100
commit70e3c2d3ad20b149da641694359101408ba3204e (patch)
tree70fbdfe808ca7007124dbfe18e1ff5a1621f24bc
parentbddb9b0050ee086da5c7ee7fdb3627e0dff9f179 (diff)
downloadmonzero-gui-70e3c2d3ad20b149da641694359101408ba3204e.tar.gz
monzero-gui-70e3c2d3ad20b149da641694359101408ba3204e.tar.xz
monzero-gui-70e3c2d3ad20b149da641694359101408ba3204e.zip
Settings, Advanced: mirror stack transition when clicking on a button on the left
-rw-r--r--components/Navbar.qml11
-rw-r--r--pages/Advanced.qml5
-rw-r--r--pages/settings/Settings.qml5
3 files changed, 16 insertions, 5 deletions
diff --git a/components/Navbar.qml b/components/Navbar.qml
index f7a55abf..3ea7c07a 100644
--- a/components/Navbar.qml
+++ b/components/Navbar.qml
@@ -32,6 +32,8 @@ import "." as MoneroComponents
Rectangle {
default property list<MoneroComponents.NavbarItem> items
+ property alias currentIndex: repeater.currentIndex
+ property alias previousIndex: repeater.previousIndex
color: "transparent"
height: grid.height
@@ -100,7 +102,10 @@ Rectangle {
}
Repeater {
+ id: repeater
model: items.length
+ property int currentIndex: 0
+ property int previousIndex: 0
RowLayout {
spacing: 0
@@ -149,7 +154,11 @@ Rectangle {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
- onClicked: items[index].selected()
+ onClicked: {
+ repeater.previousIndex = repeater.currentIndex;
+ repeater.currentIndex = index;
+ items[index].selected()
+ }
}
}
diff --git a/pages/Advanced.qml b/pages/Advanced.qml
index fbd45d76..6aa8ac46 100644
--- a/pages/Advanced.qml
+++ b/pages/Advanced.qml
@@ -43,6 +43,7 @@ ColumnLayout {
property alias state: stateView.state
MoneroComponents.Navbar {
+ id: navbarId
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: height
Layout.bottomMargin: height
@@ -128,7 +129,7 @@ ColumnLayout {
PropertyAnimation {
target: enterItem
property: "x"
- from: 0 - target.width
+ from: (navbarId.currentIndex < navbarId.previousIndex ? 1 : -1) * - target.width
to: 0
duration: 300
easing.type: Easing.OutCubic
@@ -137,7 +138,7 @@ ColumnLayout {
target: exitItem
property: "x"
from: 0
- to: target.width
+ to: (navbarId.currentIndex < navbarId.previousIndex ? 1 : -1) * target.width
duration: 300
easing.type: Easing.OutCubic
}
diff --git a/pages/settings/Settings.qml b/pages/settings/Settings.qml
index 703ea346..fdf03ce6 100644
--- a/pages/settings/Settings.qml
+++ b/pages/settings/Settings.qml
@@ -49,6 +49,7 @@ ColumnLayout {
property alias settingsStateViewState: settingsStateView.state
MoneroComponents.Navbar {
+ id: navbarId
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: height
Layout.bottomMargin: height
@@ -145,7 +146,7 @@ ColumnLayout {
PropertyAnimation {
target: enterItem
property: "x"
- from: 0 - target.width
+ from: (navbarId.currentIndex < navbarId.previousIndex ? 1 : -1) * - target.width
to: 0
duration: 300
easing.type: Easing.OutCubic
@@ -154,7 +155,7 @@ ColumnLayout {
target: exitItem
property: "x"
from: 0
- to: target.width
+ to: (navbarId.currentIndex < navbarId.previousIndex ? 1 : -1) * target.width
duration: 300
easing.type: Easing.OutCubic
}