[Development] Scalable UIs in QtQuick (take 2)
Hausmann Simon
Simon.Hausmann at theqtcompany.com
Thu Feb 18 13:46:53 CET 2016
Hi,
Yes, that is correct. But you could compare for example:
if (item.width == 5cm) {
...
}
The idea is that this it build this into the numeric literals.
Simon
________________________________
From: Development <development-bounces+simon.hausmann=theqtcompany.com at qt-project.org> on behalf of Konstantin Ritt <ritt.ks at gmail.com>
Sent: Thursday, February 18, 2016 13:20
To: Sorvig Morten
Cc: Qt Project Development Mailing-List
Subject: Re: [Development] Scalable UIs in QtQuick (take 2)
Yet another question: when we write Item { id: item; width: 5cm }, what would item.width return? value expressed in logical pixels?
Konstantin
2016-02-18 15:05 GMT+03:00 Sorvig Morten <Morten.Sorvig at theqtcompany.com<mailto:Morten.Sorvig at theqtcompany.com>>:
> On 18 Feb 2016, at 12:35, Nikita Krupenko <krnekit at gmail.com<mailto:krnekit at gmail.com>> wrote:
>
> 2016-02-18 12:50 GMT+02:00 Hausmann Simon <Simon.Hausmann at theqtcompany.com<mailto:Simon.Hausmann at theqtcompany.com>>:
>> (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.
>
> Isn't (1) already done with Qt::AA_EnableHighDpiScaling? Though
> disabling this feature for some items would be useful, like for
> Canvas, which is broken now with this scaling.
This is indeed what is done for that flag and on OS X and iOS. In that
sense logical pixels are already supported.
"px" could be added, but what are the use cases? You almost never want to
have small content on high-DPI display. I see doing custom scaling in the
application as a possible one.
As a minor platform note, "px" would not be guaranteed to be physical pixels
on Apple operating systems. There can be further resolution virtualization,
for example when setting a scaled resolution for the display.
Morten
_______________________________________________
Development mailing list
Development at qt-project.org<mailto:Development at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160218/557cc4a8/attachment.html>
More information about the Development
mailing list