Skip to content

Commit

Permalink
qml: Introduce PageView control
Browse files Browse the repository at this point in the history
Handles horizontal and vertical transitions
  • Loading branch information
jarolrod committed Oct 16, 2024
1 parent 88ce525 commit aaadb64
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ QML_RES_QML = \
qml/controls/OptionButton.qml \
qml/controls/OptionSwitch.qml \
qml/controls/OutlineButton.qml \
qml/controls/PageView.qml \
qml/controls/ProgressIndicator.qml \
qml/controls/qmldir \
qml/controls/Setting.qml \
Expand Down
1 change: 1 addition & 0 deletions src/qml/bitcoin_qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<file>controls/OptionButton.qml</file>
<file>controls/OptionSwitch.qml</file>
<file>controls/OutlineButton.qml</file>
<file>controls/PageView.qml</file>
<file>controls/ProgressIndicator.qml</file>
<file>controls/qmldir</file>
<file>controls/Setting.qml</file>
Expand Down
51 changes: 51 additions & 0 deletions src/qml/controls/PageView.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) 2024 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

import QtQuick 2.15
import QtQuick.Controls 2.15

StackView {
property bool vertical: false

pushEnter: Transition {
NumberAnimation {
property: vertical ? "y" : "x"
from: vertical ? parent.height : parent.width
to: 0
duration: 400
easing.type: Easing.Bezier
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
}
}
pushExit: Transition {
NumberAnimation {
property: vertical ? "y" : "x"
from: 0
to: vertical ? -parent.height : -parent.width
duration: 400
easing.type: Easing.Bezier
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
}
}
popEnter: Transition {
NumberAnimation {
property: vertical ? "y" : "x"
from: vertical ? -parent.height : -parent.width
to: 0
duration: 400
easing.type: Easing.Bezier
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
}
}
popExit: Transition {
NumberAnimation {
property: vertical ? "y" : "x"
from: 0
to: vertical ? parent.height : parent.width
duration: 400
easing.type: Easing.Bezier
easing.bezierCurve: [0.5, 0.0, 0.2, 1.0]
}
}
}

0 comments on commit aaadb64

Please sign in to comment.