In addition to what @TheIndependentAquarius said, you can declare property of the corresponding type in your loader:
Loader {
id: drawLineLoaderA
readonly property AA aa: item
source: "AA.qml"
}
And then use it like this:
if (drawLineLoaderA.aa) {
drawLineLoaderA.aa.color = "black"
}
Now you clearly stated that you deal with item of type AA and no other, and you'll get autocompletion on loaded item's properties as a bonus.
Note 1: Configuration of loaded item's properties should be done either in AA.qml itself (default values) or in Loader's onLoaded handler, as @troyane suggested.
Note 2: In your AA.qml you declared property string lineColour
. You might be interested in color
QML type. If you declare property color lineColour
, QML will check that you assign valid values to this property. Moreover, color
value is automatically converted to QColor when passed to C++ (and from QColor when passed from C++, of course).