Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.0.1
-
None
-
Win7/64, MSVC2010, Qt5.0.1 Commercial
Description
QQuickItem-derived C++ class imported to QML cannot be used as a "property" when "import as".
WORKS:
// FILE: MyItem0.qml
import QtQuick 2.0
import my.custom.cpp 1.0 //<==NOTE NO "as"
Item {
property MyCppType myCppType // WORKS
}
//...
DOES NOT WORK (QML compile error):
// FILE: MyItem1.qml
import QtQuick 2.0
import my.custom.cpp 1.0 as MyCpp //<==NOTE "as"
Item {
property MyCpp.MyCppType myCppType // NOT WORK
}
//...
The compile error for "import as" is at the "dot" separating the "MyCpp" from "MyCppType", with an error:
property MyCpp.MyCppType myCppType
^
"Unexpected token '.'"
The desired behavior is to permit user-defined types to be imported with the "import as" module name when those types are used as a "property".
Attachments
Issue Links
- is replaced by
-
QTBUG-10822 property declarations don't accept all types
- Closed