Skip to content

Drop qmlobjdef, support deep subproperties in qmlprop #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions tests/qml/Children.qml.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@
"30\n "
],
[
"qmlobjdef",
"border",
"width",
"qmlprop",
"border.width",
[
"stat",
[
Expand Down
File renamed without changes.
83 changes: 83 additions & 0 deletions tests/qml/Drag.qml.json
Original file line number Diff line number Diff line change
@@ -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"
]
]
]
]
5 changes: 2 additions & 3 deletions tests/qml/Properties.qml.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
"'green'\n "
],
[
"qmlobjdef",
"border",
"width",
"qmlprop",
"border.width",
[
"stat",
[
Expand Down