[Development] Perceptions/Understandings of the QML language [was: Question about Qt's future]

Rutledge Shawn Shawn.Rutledge at digia.com
Wed Apr 30 08:32:28 CEST 2014


On 29 Apr 2014, at 7:51 PM, Alan Alpert wrote:

>> (3) Document that accessing ids from other .qml files without any interface (just relying on the fact that they are in the context) creates hard to maintain QML code.
> 
> Agreed (honestly, it should already be there, I guess
> https://bugreports.qt-project.org/browse/QTBUG-20453 was never
> finished...).
> 
> Again, we have some rough plans for a ".pragma strict". Which should ban this.

What exactly do you want to ban and what are the best alternatives?  "Without any interface" implies there is a right way to share.  

- attached properties need to be created in C++ and are anyway unintuitive
- singletons need to be created in c++ and don't restrict the scope
- objects can be put in the context in c++
- a shared JS file could be used but that's not declarative
- there is no extern keyword; would it make sense to have something analogous?  but like singletons everything would be in the same name space
- combined use of "parent", and the dot operator to drill down to something not directly accessible, quickly becomes ugly

In practice I'm often not sure about the scoping rules, so when something that I think should be accessible is not, I'm often not sure if that is a bug but just start looking for another way to do it (which sometimes can be clumsy).

https://bugreports.qt-project.org/browse/QTBUG-38591 doesn't seem to have a really satisfying solution at first glanceā€¦




More information about the Development mailing list