[Development] OpenGL drivers

Sorvig Morten Morten.Sorvig at digia.com
Wed Dec 4 12:56:20 CET 2013

On 04 Dec 2013, at 11:47, Sletta Gunnar <Gunnar.Sletta at digia.com> wrote:

> QWidget has the exact opposite problem. Layouts, styles and rendering happens in pixel units while fonts are sized in point size. This is also a problem when moving between platfoms as the pixelsize of a point has a different definition on each platform. When running widgets on a hidpi screen, the fonts are usually huge compared to spacing, lines and icons. In addition to looking quite ugly it easily breaks the layout scheme set up by the application because the text takes up too much space.
> As long as one sticks to one unit type through the application everything is fine. Mixing leads to problems.
> Just thinking out loud:
> Sticking to pixels makes it possible for the application developer to make the right decision based on what he/she wants to achieve. Layout out relative to millimeters can quite easily be done by providing supporting logic in Qt.
> If we added conversion functions for inch(), cm(), mm(), points() to QQuickItem, it could look up its current window/screen object and figure out the relationship between each unit for the screen the item is on and just set that. The app can then layout in the unit space it prefers with information readily available. 

I agree on sticking to one unit. However, we've tested using screen metrics and found that not all screens report those, or worse, some return bogus values. Think about the projector case, what should it report? We also ran into odd behavior when moving windows between screens, where windows would resize themselves (or fail to do so) to accommodate to the new definition of “cm”.

I believe CSS anchors its “px” unit to either the device pixel grid (and then some integer multiple is recommended), or to physical size (for example when printing). In Qt this could be decided by the platform. The problem is however that you don’t know if you can trust the screen metrics you get.


More information about the Development mailing list