-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.9.0
-
None
Trying to instantiate a Dialog within a Component binding x,y properties will fail with a binding loop when the QtQuick.Controls import comes before the QtQuick.Dialogs one.
Steps to reproduce:
- Run the attached project or the following code:
// NOTE: Keep QtQuick.Controls before QtQuick.Dialogs in the imports import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Dialogs 1.2 Item { id: form Component { id: dialogComponent Dialog { property alias name: dialogName.text x: (parent.width - width) / 2 y: (parent.height - height) / 2 title: "Please choose a name" standardButtons: Dialog.Ok | Dialog.Cancel Row { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter spacing: 20 Label { text: qsTr("Name") verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } TextField { id: dialogName width: 217 horizontalAlignment: Text.AlignHCenter } } } } Button { id: button1 x: 256 y: 58 text: qsTr("Press Me") onClicked: { var dialog = dialogComponent.createObject(form) dialog.visible = true } } }
- Press the button and observe the following output:
qrc:/Page1.qml:18:9: QML DefaultDialogWrapper: Binding loop detected for property "x" qrc:/Page1.qml:18:9: QML DefaultDialogWrapper: Binding loop detected for property "x" qrc:/Page1.qml:18:9: QML DefaultDialogWrapper: Binding loop detected for property "y" qrc:/Page1.qml:18:9: QML DefaultDialogWrapper: Binding loop detected for property "y"
To workaround the issue just modify the order of the imports in this way:
import QtQuick 2.7 import QtQuick.Dialogs 1.2 import QtQuick.Controls 2.2
In this case the Dialog will be shown correctly.