[Development] Units in QML

André Somers andre at familiesomers.nl
Thu Feb 25 13:37:54 CET 2016



Op 25/02/2016 om 12:49 schreef Alberto Mardegan:
> On 25/02/2016 13:20, Welbourne Edward wrote:
>> André Somers used m* for minutes and metres, footnoting:
>>> )* Note the first clash already...
>> I think it is fairly sane to just insist that SI units take precedence,
>> especially given that we support multi-letter unit names (e.g. pt, px,
>> mm, cm), so min will do fine for minutes.
> I find this attention to physical units a bit improper. Sure, some
> drawing applications or text editors should be enabled to draw UI
> following specific physical dimensions (like, for example, for the ruler
> bars), but I think it's more of an isolated case than the norm.
>
> Most UIs won't set a button's height to 1 cm (or any other physical
> size), because while such a size might be OK for a desktop + mouse
> system, it would be definitely be too small for a UI in running a
> television set and too big for a UI running on a smartwatch.
>
The discussion here is units, not physical units per se. And not every 
application of QML is "drawing stuff on screen". For your application, 
pixels is just as useless a unit to start from. Perhaps you need units 
like Em or "strut" for the standard target size on your device or 
something like that. I'd like it if it were possible to define such 
units and use them in QML as a language feature.

André




More information about the Development mailing list