Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.11.1, 5.12
-
None
-
-
d8c210d7f576fc54b41ad06c061ece7cadeed648 (qt/qtbase/5.12)
Description
I found a lot of tickets that visually seem to have the same issue as me, but under different configurations. Is this a regression or has this never been fixed?
Basically, when resizing the window, the QtQuick content's resizing does not sync with the window's frame.
On my macOS this happens when the view is layer-backed. I uploaded a toy project. You can play with it.
To reproduce, you need to use multi-threaded renderloop, have the QNSView set to layer-backed, and have some sort of QuickItem that keeps the render loop busy rendering, while resizing the window (for example, a scrollview)
From some other tickets I read that there was a plan to switch to layer-backed views by default before 5.12. Are you guys still working on that?
I have looked into qpa source code and attempted to fix the issue myself. Not much success so far. What might be the problem?
System: macOS 10.13.5
Macbook Air (mid 2011) non-retina display.
Update: after more probs I found the problem disappears by using single-threaded qsg renderloop. (Doing so make the view flickers when resizing because drawRect is called when resizing when layer-backed view is used. set NSView.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever to solve this.)
It seems that the threaded render loop has issues with getting the correct frame to render into when the window is being resized.
int main(int argc, char *argv[]) { // QLoggingCategory::setFilterRules(QStringLiteral("qt.qpa.cocoa.*=true\n qt.qpa.cocoa.drawing=false")); // QLoggingCategory::setFilterRules(QStringLiteral("*=true")); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // Using QSGRendererInterface::Software does not have the issue // but on my macOS it loses the FastBlur so it's not viable for me QQuickWindow::setSceneGraphBackend(QSGRendererInterface::OpenGL); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) { return -1; } QWindow* view = QGuiApplication::allWindows()[0]; NSView* nsview = reinterpret_cast<NSView*>(view->winId()); nsview.wantsLayer = NO; // Try disabling layer-backed // Observe that when layer-backed is enabled, // the picture moves way faster than when it's not, // however, resizing the window seems to have some syncing issue nsview.layer.borderWidth = 1; return app.exec(); }
Attachments
Issue Links
- relates to
-
QTBUG-58853 When resizing a Window vertically there can be gaps between the top of the window and a header
- Closed
For Gerrit Dashboard: QTBUG-69321 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
238958,4 | macOS: Prevent flickering when resizing window rendered to by separate thread | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |
240138,1 | macOS: Prevent flickering when resizing window rendered to by separate thread | dev | qt/qtbase | Status: ABANDONED | 0 | 0 |
252659,3 | macOS: Remove screen-update disable during resize | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |