<div dir="ltr">Elvis,<div><br></div><div>I don't believe there is a reason we can't use the qreal version of devicePixelRatioF(). I think the F may have gotten dropped in a series of commits to improve DPI support.</div><div><br></div><div>A patch would be welcome.</div><div><br></div><div>Thanks,</div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 9, 2018 at 4:51 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2018-02-09 10:31 GMT+01:00 Karsten Tausche<br>
<<a href="mailto:karsten.tausche@student.hpi.uni-potsdam.de">karsten.tausche@student.hpi.<wbr>uni-potsdam.de</a>>:<br>
<span class="">> Hi Elvis,<br>
><br>
> I have a workaround for this in my own code: Basically I have a subclass of<br>
> QVTKOpenGLWidget, which disables the base class DPI support and passes Qt's<br>
> DPI value manually to the internal vtkRenderWindow. See<br>
> <a href="https://github.com/kateyy/geohazardvis/blob/master/gui/data_view/t_QVTKWidget.cpp" rel="noreferrer" target="_blank">https://github.com/kateyy/<wbr>geohazardvis/blob/master/gui/<wbr>data_view/t_QVTKWidget.cpp</a><br>
> especially lines 288 and 306.<br>
><br>
> (In the code, don't get confused about the name of the class, it provides<br>
> some support to inherit from QVTKWidget2, but you can assume<br>
> OPTION_USE_QVTKOPENGLWIDGET to be enabled.)<br>
<br>
</span>Aha, thanks a lot Karsten. I'll see if I can do something similar in<br>
our own QVTKOpenGLWidget subclass.<br>
<br>
(Still of course interested in if any of the VTK devs have looked into<br>
supporting this out of the box.)<br>
<span class="HOEnZb"><font color="#888888"><br>
Elvis<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> Cheers,<br>
> Karsten<br>
><br>
><br>
> On 09-02-18 08:43, Elvis Stansvik wrote:<br>
><br>
> Den 5 feb. 2018 3:20 em skrev "Elvis Stansvik"<br>
> <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>><wbr>:<br>
><br>
> Hi all,<br>
><br>
> My pointy-haired boss got a new laptop with a high-DPI monitor, and<br>
> started using a fractional DPI scaling factor (under KDE screen<br>
> settings). He's now reporting that our Qt/VTK app has problems with<br>
> this. The VTK windows are not correctly sized.<br>
><br>
> I've also gotten the same report from a Windows 10 user that had this<br>
> problem.<br>
><br>
> I had a look at the VTK code that sizes the render window [1]:<br>
><br>
>   const int devicePixelRatio_ = this->devicePixelRatio();<br>
>   const QSize widgetSize = this->size();<br>
>   const QSize deviceSize = widgetSize * devicePixelRatio_;<br>
><br>
> and then<br>
><br>
>   this->RenderWindow->SetSize(<wbr>deviceSize.width(), deviceSize.height());<br>
><br>
> Note the use of the int devicePixelRatio() API, not qreal<br>
> devicePixelRatioF() (available from Qt 5.6).<br>
><br>
> Does this mean there's no way to get correctly sized VTK windows when<br>
> using a fractional DPI scaling factor? If so, has anyone looked into<br>
> supporting this? Would it be a lot of work?<br>
><br>
><br>
> Noone knows? :)<br>
><br>
> If it's (like I suspect) currently not supported, I'd be willing to try to<br>
> fix it myself. But it would be good to know whether there are dragons here<br>
> (maybe that's why it's not supported yet) or if someone else is already<br>
> working on it.<br>
><br>
> Elvis<br>
><br>
><br>
> Best regards,<br>
> Elvis<br>
><br>
> [1]<br>
> <a href="https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/QVTKOpenGLWidget.cxx#L340-351" rel="noreferrer" target="_blank">https://gitlab.kitware.com/<wbr>vtk/vtk/blob/master/<wbr>GUISupport/Qt/<wbr>QVTKOpenGLWidget.cxx#L340-351</a><br>
><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://vtk.org/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtk-developers</a><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://vtk.org/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtk-developers</a><br>
><br>
><br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>
</div>