Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.10, 5.12
-
-
dbbbbe569da0aa3900a17ca22bd2be2708fb76f7 (qt/qtdeclarative/5.12)
Description
import QtQuick 2.10 import QtQuick.Layouts 1.1 Item { id: root Rectangle { id: rect width: 50 height: 50 color: "red" Layout.preferredWidth: 50 MouseArea { anchors.fill: parent onClicked: { if (rect.Layout) { console.log(rect.Layout) cnLayout.target = rect.Layout cnLayout.target = rect.Component // The same problem. // Prints: // qml: QQuickLayoutAttached(0x7fd0d6e5ad20) // file:///Users/uzumcuf/Desktop/QMLBug/main.qml|20| Error: Cannot assign null to QObject* } } } } Connections { id: cnLayout ignoreUnknownSignals: true } }
The above code results in the printed error. I'm checking to see If the `rect.Layout` is `null` or not before the assignment, the log shows that the object is not null. But QML still complains that it cannot do a nuill assignment to QObject.
I should clarify, this is not specific to Layout attached property, but to attached properties in general.