Skip to content

Commit

Permalink
qml: add NavigationBar2
Browse files Browse the repository at this point in the history
  • Loading branch information
promag committed Sep 12, 2023
1 parent ee4dc7d commit 3505b2c
Show file tree
Hide file tree
Showing 3 changed files with 66 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 @@ -367,6 +367,7 @@ QML_RES_QML = \
qml/controls/NavButton.qml \
qml/controls/PageIndicator.qml \
qml/controls/NavigationBar.qml \
qml/controls/NavigationBar2.qml \
qml/controls/OptionButton.qml \
qml/controls/OptionSwitch.qml \
qml/controls/OutlineButton.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 @@ -28,6 +28,7 @@
<file>controls/NavButton.qml</file>
<file>controls/PageIndicator.qml</file>
<file>controls/NavigationBar.qml</file>
<file>controls/NavigationBar2.qml</file>
<file>controls/OptionButton.qml</file>
<file>controls/OptionSwitch.qml</file>
<file>controls/OutlineButton.qml</file>
Expand Down
64 changes: 64 additions & 0 deletions src/qml/controls/NavigationBar2.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2023 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
import QtQuick.Layouts 1.15

Pane {
property alias leftItem: left_section.contentItem
property alias centerItem: center_section.contentItem
property alias rightItem: right_section.contentItem

background: null
padding: 4
contentItem: RowLayout {
Div {
id: left_div
Layout.preferredWidth: Math.floor(Math.max(left_div.implicitWidth, right_div.implicitWidth))
contentItem: RowLayout {
Section {
id: left_section
}
Spacer {
}
}
}
Section {
id: center_section
}
Div {
id: right_div
Layout.preferredWidth: Math.floor(Math.max(left_div.implicitWidth, right_div.implicitWidth))
contentItem: RowLayout {
Spacer {
}
Section {
id: right_section
}
}
}
}

component Div: Pane {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
Layout.minimumWidth: implicitWidth
background: null
padding: 0
}

component Section: Pane {
Layout.alignment: Qt.AlignCenter
Layout.minimumWidth: implicitWidth
background: null
padding: 0
}

component Spacer: Item {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
height: 1
}
}

0 comments on commit 3505b2c

Please sign in to comment.