[vtk-developers] Fractional DPI scaling not supported by QVTKOpenGLWidget?

Elvis Stansvik elvis.stansvik at orexplore.com
Fri Feb 9 02:43:06 EST 2018


Den 5 feb. 2018 3:20 em skrev "Elvis Stansvik" <elvis.stansvik at orexplore.com
>:

Hi all,

My pointy-haired boss got a new laptop with a high-DPI monitor, and
started using a fractional DPI scaling factor (under KDE screen
settings). He's now reporting that our Qt/VTK app has problems with
this. The VTK windows are not correctly sized.

I've also gotten the same report from a Windows 10 user that had this
problem.

I had a look at the VTK code that sizes the render window [1]:

  const int devicePixelRatio_ = this->devicePixelRatio();
  const QSize widgetSize = this->size();
  const QSize deviceSize = widgetSize * devicePixelRatio_;

and then

  this->RenderWindow->SetSize(deviceSize.width(), deviceSize.height());

Note the use of the int devicePixelRatio() API, not qreal
devicePixelRatioF() (available from Qt 5.6).

Does this mean there's no way to get correctly sized VTK windows when
using a fractional DPI scaling factor? If so, has anyone looked into
supporting this? Would it be a lot of work?


Noone knows? :)

If it's (like I suspect) currently not supported, I'd be willing to try to
fix it myself. But it would be good to know whether there are dragons here
(maybe that's why it's not supported yet) or if someone else is already
working on it.

Elvis


Best regards,
Elvis

[1] https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/
QVTKOpenGLWidget.cxx#L340-351
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20180209/3f5ad733/attachment.html>


More information about the vtk-developers mailing list