(StatusSectionLayout): Added back button in StatusChatToolbar (#903)

To be used in header in all sections where it's needed

Needed for https://github.com/status-im/status-desktop/issues/7312
This commit is contained in:
Alexandra Betouni 2022-09-21 16:31:47 +03:00 committed by Michał Cieślak
parent b1d6e73e2f
commit 367324e422
3 changed files with 35 additions and 5 deletions

View File

@ -44,8 +44,6 @@ StatusSectionLayout {
spacing: 18
StatusBaseText {
Layout.topMargin: d.layoutVMargin
Layout.leftMargin: d.layoutHMargin
text: qsTr("Find community")
font.weight: Font.Bold
font.pixelSize: d.titlePixelSize

View File

@ -9,10 +9,12 @@ import StatusQ.Controls 0.1
ToolBar {
id: root
property string backButtonName: ""
property int notificationCount: 0
property Item headerContent
property alias notificationButton: notificationButton
signal backButtonClicked()
signal notificationButtonClicked()
implicitWidth: visible ? 518 : 0
@ -23,6 +25,18 @@ ToolBar {
RowLayout {
anchors.fill: parent
spacing: 0
StatusFlatButton {
icon.name: "arrow-left"
icon.width: 20
icon.height: 20
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.leftMargin: 12
visible: !!root.backButtonName
text: root.backButtonName
size: StatusBaseButton.Size.Large
onClicked: { root.backButtonClicked(); }
}
Control {
id: headerContentItem
Layout.fillWidth: !!headerContent

View File

@ -81,11 +81,19 @@ SplitView {
property bool showHeader: true
/*!
\qmlproperty int StatusAppLayout::notificationCount
This property holds the number of notifications to be displayed in the notifications
button of the header component.
\qmlproperty alias StatusAppLayout::notificationCount
This property holds a reference to the notificationCount property of the
header component.
*/
property alias notificationCount: statusToolBar.notificationCount
/*!
\qmlproperty alias StatusAppLayout::backButtonName
This property holds a reference to the backButtonName property of the
header component.
*/
property alias backButtonName: statusToolBar.backButtonName
/*!
\qmlproperty alias StatusAppLayout::headerContent
This property holds a reference to the custom header content of
@ -99,6 +107,13 @@ SplitView {
*/
property alias notificationButton: statusToolBar.notificationButton
/*!
\qmlsignal
This signal is emitted when the back button of the header component
is pressed.
*/
signal backButtonClicked()
/*!
\qmlsignal
This signal is emitted when the notification button of the header component
@ -134,6 +149,9 @@ SplitView {
id: statusToolBar
width: visible ? parent.width : 0
visible: root.showHeader
onBackButtonClicked: {
root.backButtonClicked();
}
onNotificationButtonClicked: {
root.notificationButtonClicked();
}