fix(StatusDropdown): Add workaround for QTBUG-87804

The workaround has no known side-effects and it doesn't break
any bindings.
This commit is contained in:
Michał Cieślak 2023-05-12 13:50:13 +02:00 committed by Michał
parent e457f49879
commit 3b2a5995aa
1 changed files with 23 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import QtQuick 2.13 import QtQuick 2.15
import QtGraphicalEffects 1.13 import QtGraphicalEffects 1.15
import QtQuick.Controls 2.14 as QC import QtQuick.Controls 2.15 as QC
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
@ -28,16 +28,17 @@ import StatusQ.Core.Theme 0.1
For a list of components available see StatusQ. For a list of components available see StatusQ.
*/ */
QC.Popup { QC.Popup {
id: root
dim: false dim: false
closePolicy: QC.Popup.CloseOnPressOutside | QC.Popup.CloseOnEscape closePolicy: QC.Popup.CloseOnPressOutside | QC.Popup.CloseOnEscape
background: Rectangle { background: Rectangle {
id: border
color: Theme.palette.statusMenu.backgroundColor color: Theme.palette.statusMenu.backgroundColor
radius: 8 radius: 8
border.color: "transparent" border.color: "transparent"
layer.enabled: true layer.enabled: true
layer.effect: DropShadow { layer.effect: DropShadow {
source: border source: root.background
horizontalOffset: 0 horizontalOffset: 0
verticalOffset: 4 verticalOffset: 4
radius: 12 radius: 12
@ -46,4 +47,21 @@ QC.Popup {
color: Theme.palette.dropShadow color: Theme.palette.dropShadow
} }
} }
// workaround for https://bugreports.qt.io/browse/QTBUG-87804
Binding on margins{
id: workaroundBinding
when: false
}
Connections {
target: root.contentItem
function onImplicitHeightChanged() {
workaroundBinding.value = root.margins + 1
workaroundBinding.when = true
workaroundBinding.when = false
}
}
} }