[Development] Wayland: getting a screen's fractional scale before the first window exists
Morten Sørvig
Morten.Sorvig at qt.io
Thu Aug 13 12:27:15 CEST 2026
On 08/08/2026, 00:38, "Jamie Fitzgerald via Development" <development at qt-project.org <mailto:development at qt-project.org>> wrote:
>The case: "use QWindow::devicePixelRatio() instead" has been the answer each time, and for most applications it's the right one. It doesn't apply here because there is no window yet. The layout happens before any surface is committed, so wp_fractional_scale_v1's preferred_scale event (Morten's question on 590173) hasn't arrived and can't.
Use QWindow::devicePixelRatio(), together with "let Qt handle the scaling" continues to be the answer,
also in cases where the QWindow is not on a screen yet and has an undetermined DPR, but maybe we can
drill into it a bit. I'd like to understand were Qt's high-dpi support falls short for LibreOffice.
For the menu/toolbar case Qt's standard answer is to size the widget/item to fit its contents. This can be done
by setting a fixed size, or by using layouts. At window expose time Qt then sizes the native window and paints
using the DPR/scale factor.
If you have two active scaling subsystems (Qt and LibreOffice's own), how do you avoid double scaling?
Morten
More information about the Development
mailing list