[SailfishDevel] Dynamically populate a ContextMenu: use of _underscore properties

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sun Nov 24 09:26:50 UTC 2013


Andrey

I beg to differ.

You can hack in any language, just as you can apply clean coding  
conventions. QML is no different here, it is just a little less  
rigorous in enforcing some conventions.

Just like any code, QML code will need maintaining, updating etc, so I  
prefer to clean code and follow the conventions where they make sense.

http://harmattan-dev.nokia.com/docs/library/html/qt4/qml-coding-conventions.html clearly states that double underscore are private, not for external  
use.

So it's hands off double underscores, but this raises the moot point:  
what about single underscores like _contentColumn? By a strict reading  
of the conventions they are not private, so what does a single  
underscore imply?

Chris

Zitat von "Andrey Kozhevnikov" <coderusinbox at gmail.com>:

> Please check ContextMenu and ComboBox code.
> _contentColumn property used in a proper way.
>
> QML is not C++ where you not allowed to reimplement headers to use  
> private and protected functions outside. QML is hack-for-fun.
>
> On 24.11.2013 00:03, christopher.lamb at thurweb.ch wrote:
>> We should not have to make that choice.
>>
>> using an underscore property is the pragmatic solution, but I would  
>> be interested to hear what the Jolla developers have to say on this  
>> issue.
>>
>> Zitat von "Andrey Kozhevnikov" <coderusinbox at gmail.com>:
>>
>>> You should use it if you want "real" dynamically created components.
>>> Or reimplement ContextMenu item.
>>>
>>> What would you prefer?
>>
>>
>>
>
>




More information about the Devel mailing list