[Qt-qml] documenting the Qml grammar
Nigel.Hietala at nokia.com
Nigel.Hietala at nokia.com
Tue May 18 15:26:58 CEST 2010
<snip>
QmlObjectDefinition:
QmlQualifiedId '{' QmlObjectMember* '}'
This isn't related to the grammar, but I think reusing an object definition to
group property bindings isn't great. It can easily confuse new users and
complicates documenting the Qml syntax. A QmlObjectDefinition defines a new
object - except when it groups property bindings instead!
<snip>
This bugs me as well. Now we have several issues.
1. You can write code in 2 ways
Style 1
Item {
anchors.left: parent.left
anchors.right : parent.right
}
Style 2
Item {
anchors {
left: parent.left
right: parent.right
}
}
I don't like more than one way to do the same thing. I know in some situations one way is more verbose than the other. But with autocomplete in Creator it is no big deal.
Which leads to the other tooling issues.
If in the visual editor we set anchors do we use style 1 or 2 in the re-writer? Don't suggest a preference! Creator has enough of those.
Having 2 styles means autocomplete cannot be extra clever. It would be great if autocomplete could also add the colon : and dot . onto things you type. So that 'wid' would complete to 'width:' and 'anc' would complete to 'anchors.'. But we cannot do that for things like anchors and fonts as depending on the style you use it should add a dot '.' or an open curly brace '{'.
I also find QML a bit harder to read when there are 2 styles of saying the same thing. I agree a complex anchor looks a bit horrible in style 1. But it is not unreadable.
All the problems would go away if we just had one style and that style was style 1 with the dot syntax.
- Nigel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100518/717410ab/attachment.html
More information about the Qt-qml
mailing list