This is a known issue: QTBUG-10822
Dot symbol in "type" field of property definition operator
Question
I am using Qt 5.2 and QtQuick 2.2. In my project I have several modules that are placed in separated directories. My problem is that I can't use dot-separator in typename while defining properties. For example:
MyRect.qml
import QtQuick 2.2
Rectangle {
id: root
property color rectColor: "white"
color: root.rectColor
}
MyRectInRect.qml
import QtQuick 2.2
import "./" as MyModule
Rectangle {
id: root
property MyModule.MyRect innerRect: MyModule.MyRect { }
// ^ error: Unexpected token `.'; Unexpected token `identifier'
}
I have searched for something that could explain this behavior in the manual, but looks like there is nothing about it there. I guess that dot symbol is not allowed to be used in "type" field of property definition. But is there any way to explicitly define, what component from which module should be used as a type? Cause there may be need of declaring properties with same typenames, but from different modules.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow