refactor(StatusModal): Remove custom content property

BREAKING CHANGES:
- `content` property removed
- `Loader` inside StatusModal removed
- default `contentItem` property should be used now

Closes: #306
This commit is contained in:
B.Melnik 2021-09-01 12:18:53 +03:00 committed by Pascal Precht
parent d64aa6deed
commit 4a6800ed77
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
4 changed files with 21 additions and 33 deletions

View File

@ -752,7 +752,7 @@ Rectangle {
icon.name: "notification"
}
content: StatusBaseText {
contentItem: StatusBaseText {
anchors.centerIn: parent
text: "Contact request will be shown here"
font.pixelSize: 15
@ -781,7 +781,7 @@ Rectangle {
header.subTitle: "Public Community"
header.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
content: Column {
contentItem: Column {
width: demoCommunityDetailModal.width
StatusModalDivider {

View File

@ -145,7 +145,7 @@ Column {
}
]
content: StatusBaseText {
contentItem: StatusBaseText {
anchors.centerIn: parent
text: "Some text content"
font.pixelSize: 15
@ -169,7 +169,7 @@ Column {
header.title: "Header"
header.subTitle: "SubTitle"
content: StatusBaseText {
contentItem: StatusBaseText {
id: text
anchors.centerIn: parent
text: "Some text content"
@ -181,7 +181,7 @@ Column {
StatusButton {
text: "Change text"
onClicked: {
modalWithContentAccess.contentComponent.text = "Changed!"
modalWithContentAccess.contentItem.text = "Changed!"
}
}
]
@ -195,8 +195,7 @@ Column {
header.icon.isLetterIdenticon: true
header.icon.background.color: "red"
content: StatusBaseText {
id: text
contentItem: StatusBaseText {
anchors.centerIn: parent
text: "Some text content"
font.pixelSize: 15
@ -207,7 +206,7 @@ Column {
StatusButton {
text: "Change text"
onClicked: {
modalWithContentAccess.contentComponent.text = "Changed!"
modalWithLetterIdenticon.contentItem.text = "Changed!"
}
}
]
@ -222,8 +221,7 @@ Column {
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
header.image.isIdenticon: true
content: StatusBaseText {
id: text
contentItem: StatusBaseText {
anchors.centerIn: parent
text: "Some text content"
font.pixelSize: 15
@ -234,7 +232,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
StatusButton {
text: "Change text"
onClicked: {
modalWithContentAccess.contentComponent.text = "Changed!"
modalWithIdenticon.contentItem.text = "Changed!"
}
}
]
@ -250,8 +248,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
header.image.isIdenticon: true
content: StatusBaseText {
id: text
contentItem: StatusBaseText {
anchors.centerIn: parent
text: "Some text content"
font.pixelSize: 15
@ -262,7 +259,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
StatusButton {
text: "Change text"
onClicked: {
modalWithContentAccess.contentComponent.text = "Changed!"
modalWithLongTitles.contentItem.text = "Changed!"
}
}
]

View File

@ -11,12 +11,9 @@ import "statusModal" as Spares
QC.Popup {
id: statusModal
property Component content
property alias headerActionButton: headerImpl.actionButton
property StatusModalHeaderSettings header: StatusModalHeaderSettings {}
property alias contentComponent: contentLoader.item
property alias rightButtons: footerImpl.rightButtons
property alias leftButtons: footerImpl.leftButtons
property bool showHeader: true
@ -27,10 +24,12 @@ QC.Popup {
parent: QC.Overlay.overlay
width: 480
height: contentItem.implicitHeight
implicitHeight: contentItem.implicitHeight + headerImpl.implicitHeight + footerImpl.implicitHeight
margins: 0
padding: 0
topPadding: headerImpl.implicitHeight
bottomPadding: footerImpl.implicitHeight
leftPadding: 0
rightPadding: 0
modal: true
@ -42,12 +41,10 @@ QC.Popup {
background: Rectangle {
color: Theme.palette.statusModal.backgroundColor
radius: 8
}
contentItem: Column {
width: parent.width
Spares.StatusModalHeader {
id: headerImpl
anchors.top: parent.top
width: visible ? parent.width : 0
visible: statusModal.showHeader
@ -62,15 +59,9 @@ QC.Popup {
onClose: statusModal.close()
}
Loader {
id: contentLoader
width: parent.width
active: true
sourceComponent: statusModal.content
}
Spares.StatusModalFooter {
id: footerImpl
anchors.bottom: parent.bottom
width: visible ? parent.width : 0
visible: statusModal.showFooter
}

View File

@ -17,7 +17,7 @@ StatusModal {
showHeader: false
showFooter: false
property string searchText: contentComponent.searchText
property string searchText: contentItem.searchText
property string noResultsLabel: "No results"
property string defaultSearchLocationText: "Anywhere"
property bool loading
@ -51,7 +51,7 @@ StatusModal {
setSearchSelection(defaultSearchLocationText, "", "", false, "", "transparent")
}
content: Item {
contentItem: Item {
width: parent.width
height: root.height
property alias searchText: inputText.text
@ -348,6 +348,6 @@ StatusModal {
onClosed: {
root.resetSearchSelection();
root.loading = false;
contentComponent.searchText = "";
contentItem.searchText = "";
}
}