Details
-
Bug
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
5.15.12
-
Windows 10 Pro 22H2, MSVC 2019 x64
Description
Code
// widget.h class Widget : public QWidget { Q_OBJECT public: Widget(QWidget* parent = nullptr) : QWidget(parent) {} protected: void paintEvent(QPaintEvent*) { QPainter p(this); p.drawLine(0, 0, width(), height()); p.drawLine(0, height(), width(), 0); } };
// main.cpp int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // Enabling/disabling this has no effect QApplication app(argc, argv); Widget win; win.setMaximumSize(600, 400); win.show(); return app.exec(); }
Steps to reproduce
- Set up 2 screens, with 125% scaling on the first and 100% on the second.
- Build and run the attached project. Launch the application on the 125% screen.
- Very gradually, move the window towards the second screen, until just after the window scaling changes
- Very gradually, move the window towards the original screen
If the glitch doesn't occur on the first attempt, try a few more times.
Outcome
During both transitions, glitching occurs.
Scope of bug
- The issue also occurs if we replace setFixedSize() with setMinimumSize() and setMaximumSize(), giving the same sizes
- The issue does not occur if we replace setFixedSize() with resize()
- The issue does not occur in Qt 6
Workaround
Set a maximum size that is very close to (but not equal to) the minimum size:
win.setMaximumSize(601, 400); win.setMinimumSize(600, 400);