[Interest] Namespace on Custom C++ property in QML?

Charley Bay charleyb123 at gmail.com
Mon Feb 25 22:55:29 CET 2013


>
> charley sayeth:
> > 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"?
>

Alan respondeth:

> I wouldn't so much say "not allowed" as not working. This looks like a
> bug to me, please file it at bugreports.qt-project.org .
>
>
Reported to:

  https://bugreports.qt-project.org/browse/QTBUG-29901

Thanks!

--charley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130225/9a90f2fb/attachment.html>


More information about the Interest mailing list