diff --git a/src/api.js b/src/api.js index c409021..b04e88e 100644 --- a/src/api.js +++ b/src/api.js @@ -280,16 +280,19 @@ function qmlweb_parse($TEXT, document_type, exigent_mode) { } else if (is("punc", ".")) { // property statement // anchors, fonts etc, a.b: statement; // Can also be Component.onCompleted: ... - // Assume only one subproperty - next(); - var subname = S.token.value; - next(); + var fullname = propname; + while (is("punc", ".")) { + next(); + var subname = S.token.value; + fullname += '.' + subname; + next(); + } /* Check for ModuleQualifier.QMLElement */ if (qml_is_element(subname)) { - return as("qmlelem", propname + "." + subname, undefined, qmlblock()); + return as("qmlelem", fullname, undefined, qmlblock()); } expect(":"); - return as_statement("qmlobjdef", propname, subname); + return as_statement("qmlprop", fullname); } else if (qml_is_element(propname)) { // Element var onProp; diff --git a/tests/qml/Children.qml.json b/tests/qml/Children.qml.json index 58dfd61..5c17e93 100644 --- a/tests/qml/Children.qml.json +++ b/tests/qml/Children.qml.json @@ -161,9 +161,8 @@ "30\n " ], [ - "qmlobjdef", - "border", - "width", + "qmlprop", + "border.width", [ "stat", [ diff --git a/tests/failing/Drag.qml b/tests/qml/Drag.qml similarity index 100% rename from tests/failing/Drag.qml rename to tests/qml/Drag.qml diff --git a/tests/qml/Drag.qml.json b/tests/qml/Drag.qml.json new file mode 100644 index 0000000..950762d --- /dev/null +++ b/tests/qml/Drag.qml.json @@ -0,0 +1,83 @@ +[ + "toplevel", + [ + [ + "qmlimport", + "QtQuick", + 2, + "", + true + ] + ], + [ + "qmlelem", + "Rectangle", + null, + [ + [ + "qmlprop", + "width", + [ + "stat", + [ + "num", + 100 + ] + ], + "100\n " + ], + [ + "qmlprop", + "height", + [ + "stat", + [ + "num", + 100 + ] + ], + "100\n\n " + ], + [ + "qmlprop", + "Drag.hotSpot.x", + [ + "stat", + [ + "binary", + "/", + [ + "name", + "width" + ], + [ + "num", + 2 + ] + ] + ], + "width / 2\n " + ], + [ + "qmlprop", + "Drag.hotSpot.y", + [ + "stat", + [ + "binary", + "/", + [ + "name", + "height" + ], + [ + "num", + 2 + ] + ] + ], + "height / 2\n" + ] + ] + ] +] \ No newline at end of file diff --git a/tests/qml/Properties.qml.json b/tests/qml/Properties.qml.json index fd46f7c..980fdd4 100644 --- a/tests/qml/Properties.qml.json +++ b/tests/qml/Properties.qml.json @@ -51,9 +51,8 @@ "'green'\n " ], [ - "qmlobjdef", - "border", - "width", + "qmlprop", + "border.width", [ "stat", [