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

Elvis Stansvik elvis.stansvik at orexplore.com
Mon Feb 5 09:28:12 EST 2018


I also found that at one point, the devicePixelRatioF() API was
actually used, but only for sizing the FBO I think? [1]

And that code was replaced by what is now there.

Elvis

[1] https://gitlab.kitware.com/vtk/vtk/commit/e87abbc7ff53042d96dadad50a78cd7506dd951c#ff9f7e77fdcdf5bd80bdf3a1e1e95bdaf60f2621_354_333

2018-02-05 15:20 GMT+01:00 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?
>
> 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