On Wed, Jul 16, 2014 at 4:32 PM, Jean-Marc Lasgouttes
<lasgout...@lyx.org> wrote:
> Le 16/07/14 20:41, Marcelo Galvão Póvoa a écrit :
>
>>> * adding a fake variable to lyxrc is bad :)
>>
>>
>> Is there a better alternative? The variable can be made customizable
>> like the others but I don't know if it makes sense.
>
>
> Why not use the value given by the current Window? Isn't it possible to
> access it? You get it from a function, there is no need to store it in a
> variable.
>
> Note moreover that the documentation says
>
>   Use this function only when you don't know which window you are
>   targeting. If you do know the target window, use
>   QWindow::devicePixelRatio() instead.
>
> [Think about a Retina MacBook plugged into a LowDPI external monitor. One
> needs to know on what monitor the Window is]
>
> Note that you can create a fake devicePixelRatio() method for Qt4.
>

I'm not sure how to easily get a pointer to the window containing the
current workarea in every part of the code I need to use pixel_ratio.
I could use the globally available qApp->activeWindow() macro, but
what if the active window is a dialog window instead of the workarea?

Besides, I currently need the device_ratio in some parts outside the
Qt frontend (for example, in src/insets/RenderGraphic.cpp), so I
couldn't access the window from there.

Having multiple pixel ratios can indeed be an issue. For example, if a
GuiImage is created in a HiDPI screen, it would be assigned a 2x ratio
during initialization. But if the window is moved to a LowDPI screen
afterwards, the image ratio would need to be updated.

Marcelo

Reply via email to