I get this message in QtCreator output:
file:///C:/.../foo.qml:428:5: QML PopupWarning: Binding loop detected for property "implicitHeight":
qrc:/qt-project.org/imports/QtQuick/Controls/FluentWinUI3/Dialog.qml:16:5
"PopupWarning.qml":
import QtQuick
import QtQuick.Controls
Dialog {
parent: Overlay.overlay
property alias text : dialogText.text
anchors.centerIn: parent
width: parent.width/2
dim: true
modal: true
//implicitHeight: dialogText.height
Text {
id: dialogText
width: parent.width
font.pointSize: 15
}
}
The problem is that I cannot specify exact height, because the Text inside dialog may be of various lengths. The same with the title. Also, standardButtons may or may not be present. And I would like to keep the Dialog size as small as possible. The code works, but I would like to prevent all warnings.
Question: is there some way to calculate the height of the Dialog/Popup in this situation?
I found a way to calculate the height in my case:
height: (standardButtons != Dialog.NoButton) ? header.height + footer.height + dialogText.height + 35 : header.height + dialogText.height + 35
The value of 35 comes from this equation (when you did not specify the dialog height):
Component.onCompleted: console.log(height - dialogText.height)
Visually it looks exactly the same, even if I change the font size