Skip to content

Commit d49b888

Browse files
committed
qml: Introduce PageStack control
Introduces a custom PageStack control that is a StackView adapted for our use in terms of the custom animations we demand, and the ability to switch between vertical and horizontal push() and pop(). This can later be further extended for our use cases.
1 parent 15c1f39 commit d49b888

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ QML_RES_QML = \
398398
qml/controls/OptionButton.qml \
399399
qml/controls/OptionSwitch.qml \
400400
qml/controls/OutlineButton.qml \
401+
qml/controls/PageStack.qml \
401402
qml/controls/ProgressIndicator.qml \
402403
qml/controls/qmldir \
403404
qml/controls/Setting.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<file>controls/OptionButton.qml</file>
3939
<file>controls/OptionSwitch.qml</file>
4040
<file>controls/OutlineButton.qml</file>
41+
<file>controls/PageStack.qml</file>
4142
<file>controls/ProgressIndicator.qml</file>
4243
<file>controls/qmldir</file>
4344
<file>controls/Setting.qml</file>

src/qml/controls/PageStack.qml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) 2024 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
8+
StackView {
9+
property bool vertical: false
10+
11+
pushEnter: Transition {
12+
NumberAnimation {
13+
property: vertical ? "y" : "x"
14+
from: vertical ? parent.height : parent.width
15+
to: 0
16+
duration: 400
17+
easing.type: Easing.Bezier
18+
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
19+
}
20+
}
21+
pushExit: Transition {
22+
NumberAnimation {
23+
property: vertical ? "y" : "x"
24+
from: 0
25+
to: vertical ? -parent.height : -parent.width
26+
duration: 400
27+
easing.type: Easing.Bezier
28+
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
29+
}
30+
}
31+
popEnter: Transition {
32+
NumberAnimation {
33+
property: vertical ? "y" : "x"
34+
from: vertical ? -parent.height : -parent.width
35+
to: 0
36+
duration: 400
37+
easing.type: Easing.Bezier
38+
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
39+
}
40+
}
41+
popExit: Transition {
42+
NumberAnimation {
43+
property: vertical ? "y" : "x"
44+
from: 0
45+
to: vertical ? parent.height : parent.width
46+
duration: 400
47+
easing.type: Easing.Bezier
48+
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)