> Dear Qt developers,
> I got a new toy at work -- a 27" LCD with some crazy resolution
> (2560x1440 IIRC), i,e. its pixel density is roughly 109 PPI. The LCD I
> use at home has got a 94 PPI grid. I frequently move my laptop between
> these two places and I have yet to make my KDE 4.9 use fonts which look
> great no matter which display I switched to at runtime. The current
> state is driving me nuts; I have to constantly adjust the font size in
> KDE's preferences *and* restart the applications afterwards, so that
> they pick up the new font preferences. That's not the first thing I want
> to do when I get to work in the morning.
> 
> It looks like Qt 4.8.3 doesn't provide dynamic updates to the DPI value
> to the applications. The attached patch does just that; it simply
> updates the value which is returned by QX11Info::appDpiX() and appDpiY
> when XRandR informs about new geometry. No fancy signalling is done.
> 
> The results are actually pretty funny; it looks like a QTreeView would
> use the new font size only for text items whose font previously did not
> fit the column width while those which fit will remain in the previous
> size; there are also no changes to stuff like height of the menu bars,
> the layouts won't change, and so on. On the other hand, it's now enough
> to reopen the current file in Qt Creator and the font size reflects the
> new DPI.
> 
> I don't know anything about Qt internals (and I suspect that this is not
> exactly an area a newcomer should dive into), so I'll appreciate some
> pointers about what else would need changing in order for dynamic DPI to
> work. Or is this a futile attempt which is doomed to failure anyway? Are
> there any chances of getting this accepted, eventually?

Yes and no (depending).

There are several approaches to DPI scaling. I'm working on a patch to Qt 5 
that implements the "retina" or "web bowser" type of scaling that creates a 
distinction between device independent pixels and device pixels. Detecting and 
reacting to DPI changes would be a natural addition to the patch, but it's for 
Qt 5 only so it won't help you right away. (I have a smaller mac-only patch for 
Qt 4).

This approach has the following characteristics:
- Everything is scaled: fonts, layouts and all. There should be no "funny" 
results.
- Scaling means that Qt apps see a smaller desktop geometry. The graphics 
backing store and OpenGL contexts are full resolution.
- A 2x scale factor (around 200 PPI) works best, since there are no 
"misaligned" pixels then.
- How well it works outside of Mac OS X is uncertain. We're adapting the new 
fusion style to work in high-dpi mode and I'm optimistic that it can be useful. 

Morten






_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to