Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.0, 5.15.1
-
None
-
dcfe085ba5ff6ea82f67c4fb39e08aeb7abd1ec9 (qt/qtquickcontrols2/6.1)
Description
It should be possible to assign an object of type C to a property of type A given this inheritance: C < B < A.
Example:
MyDialog inherits QtQuick.Controls.Dialog which inherits QtQuick.Controls.Popup. So binding a MyDialog instance to a "Popup" property should work (and does work in 5.12.x).
However the following minimal example results in the property binding not working and an error message "qrc:/main.qml:15:5: Unable to assign MyDialog_QMLTYPE_11 to Popup_QMLTYPE_1".
main.qml
import QtQuick 2.12 import QtQuick.Window 2.12 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") MyDialog { id: dlg } PopupOpener { popup: dlg } }
MyDialog.qml
import QtQuick.Controls 2.12 Dialog { contentItem: Label { text: "Hello" } }
PopupOpener.qml
import QtQuick 2.12 import QtQuick.Controls 2.12 Button { property Popup popup; // error in 5.15: qrc:/main.qml:15:5: Unable to assign MyDialog_QMLTYPE_11 to Popup_QMLTYPE_1 // property Dialog popup; // ok onClicked: popup.open() text: "Open Popup" }
Attachments
Issue Links
- relates to
-
QTBUG-130336 `Button` can't be converted to `Control`
- Closed
For Gerrit Dashboard: QTBUG-88222 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
320984,6 | Document how to use Controls types in property declarations | dev | qt/qtquickcontrols2 | Status: MERGED | +2 | 0 |