I'm sure this is a silly question, but why are these different:

// FILE: MyItem0.qml
import QtQuick 2.0
import my.custom.cpp 1.0    //<==NOTE NO "as"

Item {
  property MyCppType myCppType // WORKS
}

// FILE: MyItem1.qml
import QtQuick 2.0
import my.custom.cpp 1.0 as MyCpp   //<==NOTE "as"

Item {
  property MyCpp.MyCppType myCppType // NOT WORK
}

QUESTION:  If I import the C++ custom types with an "as MyCpp", then I can
no longer use the type as a "property" within QML.  Dropping the
"as-module" name works.

The compile error is at the "dot" separating the "MyCpp" from "MyCppType",
with an error:

 property MyCpp.MyCppType myCppType
>             ^
>   "Unexpected token '.'"


I assume package/namespace/plugin scoping names are not allowed for
defining properties in QML?  Does this mean you can't use "as-namespaces"
in a QML file when you want that C++ type as a "property"?

Just curious.  Thanks!

--charley
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to