Qt6 & V3d_Viewer using occtWindow class implementation device pixel ratio issue

Hello there!
I am having an issue with my implementation. I have created a QApplication which is based on a QMainWindow, with several widgets embedded to it. One of the widgets is used to visualize occt entities using a V3d_Viewer, V3d_View etc. In my implementation I use the following line of code in order to create and set a Window to this view:
Handle(OcctWindow) hWnd=new OcctWindow(this);
The OcctWindow class is based on the below implementation:
https://git.dev.opencascade.org/gitweb/?p=occt.git;a=blob;f=samples/qt/C...
I experienced the following problem. When my desktop application loads and all the widgets are visualized, the one that has this OcctWindow class, malfunctions, in the sense that the rendered background only appears on the lower left side of the screen. I realized that it is an issue of my display settings, since I have a scale factor of 225%. If I use a scale factor of 100% everything appears as it should. I managed to see the Device Pixel Ratio for both my QApplication and the occtWindow and the values where 2.25 and 1.00 respectively.
I recently transitioned from Qt5 to Qt6.
Is there a way to counter this? Any feedback would be much appreciated.

Attachments: 
纪港 马's picture

Hello, I also encountered this problem, can you please solve it?

David Swall's picture

void OcctWindow::Size ( Standard_Integer& theWidth, Standard_Integer& theHeight ) const
{
//QRect aRect = myWidget->rect();
//theWidth = aRect.width();
//theHeight = aRect.height();
QRect aRect = myWidget->rect();
QScreen *screen = QGuiApplication::primaryScreen();
const int baseValue = 96;
qreal dpiVal = screen->logicalDotsPerInch();
qreal ratioVal = screen->devicePixelRatio();
auto factor = dpiVal * ratioVal / baseValue;
theWidth = aRect.width() * factor;
theHeight = aRect.height() * factor;
}

solve it!!!!