fix(StatusDropdown, StatusDialog): height calculation improved

It improves workaround for QTBUG-87804 in StatusDropdown, to work
nicely whenever content is set via contentItem or not. The same
solution is added to StatusDialog.

Closes: #11768
This commit is contained in:
Michał Cieślak 2023-08-03 12:36:51 +02:00 committed by Michał
parent 780a6b6c68
commit f85986bfb0
4 changed files with 19 additions and 23 deletions

View File

@ -48,6 +48,15 @@ Item {
when: false
}
onImplicitContentHeightChanged: {
if (!workAroundCheckBox.checked)
return
workaroundBinding.value = popup.margins + 1
workaroundBinding.when = true
workaroundBinding.when = false
}
ColumnLayout {
Button {
text: "Some button 1"
@ -60,15 +69,6 @@ Item {
Layout.fillWidth: true
}
onImplicitHeightChanged: {
if (!workAroundCheckBox.checked)
return
workaroundBinding.value = popup.margins + 1
workaroundBinding.when = true
workaroundBinding.when = false
}
anchors.fill: parent
ListView {

View File

@ -57,13 +57,9 @@ QC.Popup {
restoreMode: Binding.RestoreBindingOrValue
}
Connections {
target: root.contentItem
function onImplicitHeightChanged() {
workaroundBinding.value = root.margins + 1
workaroundBinding.when = true
workaroundBinding.when = false
}
onImplicitContentHeightChanged: {
workaroundBinding.value = root.margins + 1
workaroundBinding.when = true
workaroundBinding.when = false
}
}

View File

@ -37,6 +37,12 @@ Dialog {
restoreMode: Binding.RestoreBindingOrValue
}
onImplicitContentHeightChanged: {
workaroundBinding.value = root.margins + 1
workaroundBinding.when = true
workaroundBinding.when = false
}
standardButtons: Dialog.Cancel | Dialog.Ok
Overlay.modal: Rectangle {

View File

@ -167,12 +167,6 @@ StatusDialog {
anchors.fill: parent
// Workaround for https://bugreports.qt.io/browse/QTBUG-87804
onImplicitHeightChanged: {
margins--
margins++
}
ClippingWrapper {
Layout.fillWidth: true
Layout.preferredHeight: assetAndAmountSelector.implicitHeight