Skip to content

generatePage: Select correct devicePixelRatio

I am trying to work on Plasma Wayland with my main (laptop) screen scaled to 125%, and an external screen scaled to 100%. When opening the presentation view, the screen becomes partially filled with garbage, like here: (that's a link to a different bug report, but cause and effect are the same).

The reason is that the method PresentationWidget::generatePage uses qApp->devicePixelRatio() to determine the device pixel ratio. However, according to the Qt documentation at , that method returns "the highest screen device pixel ratio found on the system", not the one for the current screen. It says: "Use this function only when you don't know which window you are targeting.", which is clearly not the case here.

Setting the device pixel ratio to the correct value fixes the problem. The patch here does that in some situations. It takes the dpr from the screen where the main widget is on. This works of both main widget and presentation view are on the same screen, but not in other cases. Here I am stuck and I need some help: How can I determine the screen that the presentation view will appear on?

Edited by Oliver Sander

Merge request reports