Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
5.15.2, 6.1.2
Description
Summary
QML does not allow to alias attached objects or their properties.
Description
I don't see any technical restrictions as to why not support them. Attached properties are designed to be "on-demand" kind of things, but sometimes you may want them to always exist on an object, such as property alias actionId: textInput.EnterKeyAction.actionId from QtQuick.VirtualKeyboard module, maybe because your Enter key will always be customized on, like, each and every of three pages it will appear at.
Steps to reproduce
import QtQuick 2.15 import QtQuick.Window 2.15 Window { id: win width: 640 height: 480 visible: true title: qsTr("Hello World") property alias ww1: Window // qrc:/main.qml:12:25: Invalid alias reference. Unable to find id "Window" property alias ww2: win.Window // qrc:/main.qml:15:25: Invalid alias target location: Window property alias ww3: Window.width // qrc:/main.qml:18:25: Invalid alias reference. Unable to find id "Window" property alias ww4: win.Window.width // qrc:/main.qml:21:25: Invalid alias target location: Window }
Expected result
All of those constructs should work, or at least ID-qualified ones.
Actual result
Compiler errors, as shows below each property line.
Additional info complaints
It would be nice if QML compiler could spit out everything it is unhappy with at once, instead of requiring me to uncomment each line and re-run the app to retrieve the next error. Besides, "Invalid alias reference" shouldn't really be such a blocker for the rest of processing, right?
Attachments
Issue Links
- relates to
-
QTBUG-130605 Invalid alias target location unless I bind it
-
- Reported
-