QGraphicsView has all corresponding QGraphicsItems blurry due to AA_EnableHighDpiScaling flag
-
Hello,
I am attempting to use a third party library that uses QGraphicsView / Scene / Items. The application we use uses the EnableHighDpiScaling flag, however this causes all the QGraphicsItems that are rendered in this third-party library to appear blurry. I tried setting the following flags on the graphics view:
view_->setRenderHint(QPainter::TextAntialiasing, true); view_->setRenderHint(QPainter::SmoothPixmapTransform, true); view_->setRenderHint(QPainter::HighQualityAntialiasing, true);
I also attempted to do this transformation to the view:
QScreen *screen = QApplication::primaryScreen(); qreal dpiScaleFactor = screen->devicePixelRatio(); view->setTransform(QTransform::fromScale(dpiScaleFactor, dpiScaleFactor));
None of these seem to fix the issue. What is the correct way to approach an issue like this? I want to either disable DPI scaling specifically for this graphics view, or somehow get it to scale the items properly.
Note: we are using Qt 5.12. Plans to upgrade to 6 early next year.
-
Hi and welcome to devnet,
What happens if you use OpenGL for the viewport ?
One thing to keep in mind is 5.12 is obsolete and the HighDPI support has greatly improved since then.
Can you try with 5.15 to check if it goes better with that version since Qt 6 is only for next year ?