mirror of https://github.com/status-im/StatusQ.git
(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:
parent
2c43dbb207
commit
73d7e09536
|
@ -44,8 +44,6 @@ StatusSectionLayout {
|
||||||
spacing: 18
|
spacing: 18
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.topMargin: d.layoutVMargin
|
|
||||||
Layout.leftMargin: d.layoutHMargin
|
|
||||||
text: qsTr("Find community")
|
text: qsTr("Find community")
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
font.pixelSize: d.titlePixelSize
|
font.pixelSize: d.titlePixelSize
|
||||||
|
|
|
@ -9,10 +9,12 @@ import StatusQ.Controls 0.1
|
||||||
ToolBar {
|
ToolBar {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string backButtonName: ""
|
||||||
property int notificationCount: 0
|
property int notificationCount: 0
|
||||||
property Item headerContent
|
property Item headerContent
|
||||||
property alias notificationButton: notificationButton
|
property alias notificationButton: notificationButton
|
||||||
|
|
||||||
|
signal backButtonClicked()
|
||||||
signal notificationButtonClicked()
|
signal notificationButtonClicked()
|
||||||
|
|
||||||
implicitWidth: visible ? 518 : 0
|
implicitWidth: visible ? 518 : 0
|
||||||
|
@ -23,6 +25,18 @@ ToolBar {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
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 {
|
Control {
|
||||||
id: headerContentItem
|
id: headerContentItem
|
||||||
Layout.fillWidth: !!headerContent
|
Layout.fillWidth: !!headerContent
|
||||||
|
|
|
@ -81,11 +81,19 @@ SplitView {
|
||||||
property bool showHeader: true
|
property bool showHeader: true
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty int StatusAppLayout::notificationCount
|
\qmlproperty alias StatusAppLayout::notificationCount
|
||||||
This property holds the number of notifications to be displayed in the notifications
|
This property holds a reference to the notificationCount property of the
|
||||||
button of the header component.
|
header component.
|
||||||
*/
|
*/
|
||||||
property alias notificationCount: statusToolBar.notificationCount
|
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
|
\qmlproperty alias StatusAppLayout::headerContent
|
||||||
This property holds a reference to the custom header content of
|
This property holds a reference to the custom header content of
|
||||||
|
@ -99,6 +107,13 @@ SplitView {
|
||||||
*/
|
*/
|
||||||
property alias notificationButton: statusToolBar.notificationButton
|
property alias notificationButton: statusToolBar.notificationButton
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmlsignal
|
||||||
|
This signal is emitted when the back button of the header component
|
||||||
|
is pressed.
|
||||||
|
*/
|
||||||
|
signal backButtonClicked()
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlsignal
|
\qmlsignal
|
||||||
This signal is emitted when the notification button of the header component
|
This signal is emitted when the notification button of the header component
|
||||||
|
@ -134,6 +149,9 @@ SplitView {
|
||||||
id: statusToolBar
|
id: statusToolBar
|
||||||
width: visible ? parent.width : 0
|
width: visible ? parent.width : 0
|
||||||
visible: root.showHeader
|
visible: root.showHeader
|
||||||
|
onBackButtonClicked: {
|
||||||
|
root.backButtonClicked();
|
||||||
|
}
|
||||||
onNotificationButtonClicked: {
|
onNotificationButtonClicked: {
|
||||||
root.notificationButtonClicked();
|
root.notificationButtonClicked();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue