Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.8.1
-
None
Description
Example:
import QtQuick import QtQuick.Controls.Basic Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Repeater { model: ['one', 'two'] MyButton { text: modelData } } component FirstComponent : Item { required property var control } component SecondComponent : FirstComponent {} component MyButton : Button { id: btn contentItem: SecondComponent { id: myContentItem control: btn } } }
Description:
MyButton has no required properties. I expect that this sample will work and that modelData will contain 'one' or 'two'. However, when I run it (I use Qt 6.6.1 and Qt 6.8.1), I get the following error: "ReferenceError: modelData is not defined."
But if I replace SecondComponent with FirstComponent in MyButton.contentItem, or remove the id from contentItem, it works as I expect. And I don't understand why
Attachments
Issue Links
- split to
-
QTBUG-133129 DelegateModel can create delegates with unset required properties in sub-objects
- Reported
Gerrit Reviews
For Gerrit Dashboard: QTBUG-133052 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
619058,6 | QtQml: Reset top-level-required flag after processing sub-objects | dev | qt/qtdeclarative | Status: NEW | 0 | +1 |