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

Elvis Stansvik elvis.stansvik at orexplore.com
Mon Feb 5 09:20:29 EST 2018


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?

Best regards,
Elvis

[1] https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/QVTKOpenGLWidget.cxx#L340-351


More information about the vtk-developers mailing list