[Development] Scalable UIs in QtQuick (take 2)

Mike Krus mike.krus at kdab.com
Thu Feb 18 12:36:27 CET 2016


Hi

so (1) is what happens on iOS/OSX retina displays already right?
and (2) lets you turn it off?

Question then would be: would you ever need to mix?
If not, then having a global/window switch would be a lot easier than putting px everywhere…
And if you do want to mix, but mostly use px, then setting some default to px and then adding something like ‘pt’ in specific places may make sense?



Mike


> On 18 Feb 2016, at 10:50, Hausmann Simon <Simon.Hausmann at theqtcompany.com> wrote:
> 
> 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
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

--
Mike Krus | mike.krus at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK +44-1625-809908   Mobile: +44 7833 491941
KDAB - The Qt Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3859 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160218/3d67ca94/attachment.bin>


More information about the Development mailing list