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:
parent
181ed86b95
commit
cd72ef5f38
|
@ -752,7 +752,7 @@ Rectangle {
|
||||||
icon.name: "notification"
|
icon.name: "notification"
|
||||||
}
|
}
|
||||||
|
|
||||||
content: StatusBaseText {
|
contentItem: StatusBaseText {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "Contact request will be shown here"
|
text: "Contact request will be shown here"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
|
@ -781,7 +781,7 @@ Rectangle {
|
||||||
header.subTitle: "Public Community"
|
header.subTitle: "Public Community"
|
||||||
header.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
|
header.image.source: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
|
||||||
|
|
||||||
content: Column {
|
contentItem: Column {
|
||||||
width: demoCommunityDetailModal.width
|
width: demoCommunityDetailModal.width
|
||||||
|
|
||||||
StatusModalDivider {
|
StatusModalDivider {
|
||||||
|
|
|
@ -145,7 +145,7 @@ Column {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
content: StatusBaseText {
|
contentItem: StatusBaseText {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "Some text content"
|
text: "Some text content"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
|
@ -169,7 +169,7 @@ Column {
|
||||||
header.title: "Header"
|
header.title: "Header"
|
||||||
header.subTitle: "SubTitle"
|
header.subTitle: "SubTitle"
|
||||||
|
|
||||||
content: StatusBaseText {
|
contentItem: StatusBaseText {
|
||||||
id: text
|
id: text
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "Some text content"
|
text: "Some text content"
|
||||||
|
@ -181,7 +181,7 @@ Column {
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: "Change text"
|
text: "Change text"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
modalWithContentAccess.contentComponent.text = "Changed!"
|
modalWithContentAccess.contentItem.text = "Changed!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -195,8 +195,7 @@ Column {
|
||||||
header.icon.isLetterIdenticon: true
|
header.icon.isLetterIdenticon: true
|
||||||
header.icon.background.color: "red"
|
header.icon.background.color: "red"
|
||||||
|
|
||||||
content: StatusBaseText {
|
contentItem: StatusBaseText {
|
||||||
id: text
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "Some text content"
|
text: "Some text content"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
|
@ -207,7 +206,7 @@ Column {
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: "Change text"
|
text: "Change text"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
modalWithContentAccess.contentComponent.text = "Changed!"
|
modalWithLetterIdenticon.contentItem.text = "Changed!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -222,8 +221,7 @@ Column {
|
||||||
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
|
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
|
||||||
header.image.isIdenticon: true
|
header.image.isIdenticon: true
|
||||||
|
|
||||||
content: StatusBaseText {
|
contentItem: StatusBaseText {
|
||||||
id: text
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "Some text content"
|
text: "Some text content"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
|
@ -234,7 +232,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: "Change text"
|
text: "Change text"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
modalWithContentAccess.contentComponent.text = "Changed!"
|
modalWithIdenticon.contentItem.text = "Changed!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -250,8 +248,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
|
||||||
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
|
CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
|
||||||
header.image.isIdenticon: true
|
header.image.isIdenticon: true
|
||||||
|
|
||||||
content: StatusBaseText {
|
contentItem: StatusBaseText {
|
||||||
id: text
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "Some text content"
|
text: "Some text content"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
|
@ -262,7 +259,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
|
||||||
StatusButton {
|
StatusButton {
|
||||||
text: "Change text"
|
text: "Change text"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
modalWithContentAccess.contentComponent.text = "Changed!"
|
modalWithLongTitles.contentItem.text = "Changed!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -11,12 +11,9 @@ import "statusModal" as Spares
|
||||||
QC.Popup {
|
QC.Popup {
|
||||||
id: statusModal
|
id: statusModal
|
||||||
|
|
||||||
property Component content
|
|
||||||
|
|
||||||
property alias headerActionButton: headerImpl.actionButton
|
property alias headerActionButton: headerImpl.actionButton
|
||||||
|
|
||||||
property StatusModalHeaderSettings header: StatusModalHeaderSettings {}
|
property StatusModalHeaderSettings header: StatusModalHeaderSettings {}
|
||||||
property alias contentComponent: contentLoader.item
|
|
||||||
property alias rightButtons: footerImpl.rightButtons
|
property alias rightButtons: footerImpl.rightButtons
|
||||||
property alias leftButtons: footerImpl.leftButtons
|
property alias leftButtons: footerImpl.leftButtons
|
||||||
property bool showHeader: true
|
property bool showHeader: true
|
||||||
|
@ -27,10 +24,12 @@ QC.Popup {
|
||||||
parent: QC.Overlay.overlay
|
parent: QC.Overlay.overlay
|
||||||
|
|
||||||
width: 480
|
width: 480
|
||||||
height: contentItem.implicitHeight
|
implicitHeight: contentItem.implicitHeight + headerImpl.implicitHeight + footerImpl.implicitHeight
|
||||||
|
|
||||||
margins: 0
|
topPadding: headerImpl.implicitHeight
|
||||||
padding: 0
|
bottomPadding: footerImpl.implicitHeight
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
|
||||||
modal: true
|
modal: true
|
||||||
|
|
||||||
|
@ -42,12 +41,10 @@ QC.Popup {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Theme.palette.statusModal.backgroundColor
|
color: Theme.palette.statusModal.backgroundColor
|
||||||
radius: 8
|
radius: 8
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: Column {
|
|
||||||
width: parent.width
|
|
||||||
Spares.StatusModalHeader {
|
Spares.StatusModalHeader {
|
||||||
id: headerImpl
|
id: headerImpl
|
||||||
|
anchors.top: parent.top
|
||||||
width: visible ? parent.width : 0
|
width: visible ? parent.width : 0
|
||||||
|
|
||||||
visible: statusModal.showHeader
|
visible: statusModal.showHeader
|
||||||
|
@ -62,15 +59,9 @@ QC.Popup {
|
||||||
onClose: statusModal.close()
|
onClose: statusModal.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: contentLoader
|
|
||||||
width: parent.width
|
|
||||||
active: true
|
|
||||||
sourceComponent: statusModal.content
|
|
||||||
}
|
|
||||||
|
|
||||||
Spares.StatusModalFooter {
|
Spares.StatusModalFooter {
|
||||||
id: footerImpl
|
id: footerImpl
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
width: visible ? parent.width : 0
|
width: visible ? parent.width : 0
|
||||||
visible: statusModal.showFooter
|
visible: statusModal.showFooter
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ StatusModal {
|
||||||
showHeader: false
|
showHeader: false
|
||||||
showFooter: false
|
showFooter: false
|
||||||
|
|
||||||
property string searchText: contentComponent.searchText
|
property string searchText: contentItem.searchText
|
||||||
property string noResultsLabel: "No results"
|
property string noResultsLabel: "No results"
|
||||||
property string defaultSearchLocationText: "Anywhere"
|
property string defaultSearchLocationText: "Anywhere"
|
||||||
property bool loading
|
property bool loading
|
||||||
|
@ -51,7 +51,7 @@ StatusModal {
|
||||||
setSearchSelection(defaultSearchLocationText, "", "", false, "", "transparent")
|
setSearchSelection(defaultSearchLocationText, "", "", false, "", "transparent")
|
||||||
}
|
}
|
||||||
|
|
||||||
content: Item {
|
contentItem: Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: root.height
|
height: root.height
|
||||||
property alias searchText: inputText.text
|
property alias searchText: inputText.text
|
||||||
|
@ -348,6 +348,6 @@ StatusModal {
|
||||||
onClosed: {
|
onClosed: {
|
||||||
root.resetSearchSelection();
|
root.resetSearchSelection();
|
||||||
root.loading = false;
|
root.loading = false;
|
||||||
contentComponent.searchText = "";
|
contentItem.searchText = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue