I like it! Some questions though: * Does (2) include coverage for cases like 5cm ? * Could we have a solution for writing `width: 90%` instead of `width: parent.width * 0.9` as well?
Regards, Konstantin 2016-02-18 14:50 GMT+04:00 Hausmann Simon <[email protected]>: > Hi, > > A little while ago Lars and I proposed to introduce physical units in the > QML language for use in QtQuick. The idea was to make it easier to write > user interfaces that adapt to different display resolutions by "pinning" > your UI to physical dimensions. For example you could say > > Image { > source: "mypprofilephoto.png" > width: 5cm > height: 5cm > } > > and the image size in physical pixels would scale accordingly to always > produce a 5cmx5cm profile image on the screen. The proposed units included > "px", which was really an alias for nothing. > > We've had some very good discussions around this at last year's > contributor summit as well as in smaller face-to-face discussions. The main > feedback I recall was that this would seem like a nice feature on paper but > in practice people create their resolution independent interfaces using the > current "pixels" and a scale factor that they introduce in a qml file or as > a context property. That's another way of saying that perhaps the feature > wouldn't really find any use, which is fair :). Instead the desire was > expressed that making it _easier_ to scale "logical" pixels in the > application would perhaps be better. > > So today during a discussion another idea came up: > > (1) In order to make it really easy to scale "logical" pixels without > having to introduce your own context property or factor in a .qml file that > you multiply everywhere, we could turn the regular "pixels" in QtQuick into > truly logical pixels that scale with an application wide (or window wide) > factor. So Image { width: 100 ... } will scale automatically from 100 > logical pixels to maybe 200 physical pixels on a x2 display. This assumes > the availability of API to change this mapping. > > (2) In the events where you still _want_ to use physical pixels, you could > use "px" units. > > So at first nothing would change for app developers at all because we map > logical pixels to physical pixels. But > if you'd like to, you could opt into changing this mapping and having a > relatively easy fallback to physical pixels using for example the "px" > unit. We might as well offer the other physical units anyway, that probably > causes little to no harm. > > What do you think? > > Simon > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development >
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
