Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QQuickWidget is not repainting even when calling update



  • I have integrated a QQuickWidget into a fairly large and old QWidget-based application.

    m_quickWidget = new QQuickWidget();
    m_quickWidget->setSource(..."foo.qml");
    m_quickWidget->setResizeMode(QQuickWidget::ResizeMode::SizeRootObjectToView);
    
    mainWindow->centralWidget()->layout()->addWidget(m_quickWidget);
    

    The problem is, this QQuickWidget does not repaint itself e.g. on animations or hover effects or when calling update(). For testing, I subclassed QQuickWidget and verified that paintEvent(QPaintEvent) is indeed not called in these cases. I also stepped into an update()-call, it does not take an early out and reaches the tlwExtra->backingStoreTracker->markDirty(clipped, q); line.

    The widget is visible, not hidden, visibleRegion is something sensible, updatesEnabled is true, click events work, calling repaint() works, and it repaints on resizes. I removed all instances of installEventFilter from the application, it still does not get any paint events. Putting the QQuickWidget into a separate window makes the repainting work.

    Using a QQuickView in a window container instead of the QQuickWidget does not show this problem, but introduces others, which is why we are trying to make the QQuickWidget work. We could also call repaint() in a timer set to 16 milliseconds and leave it at that, but that's a rather gross hack in my opinion.

    FWIW, the window, the central widget and one of its children is a native widgets, and we've set Qt::AA_DontCreateNativeWidgetSiblings for the QQuickWidget to render at all.

    Any suggestions how I can debug this would be welcome :)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt are you using ?
    On what platform ?
    Can you provide a minimal compilable example that shows that behaviour ?



  • Sorry. I tested with Qt 5.11.0 and 5.12.0, and newest Windows 10 x64. I have built a small application with roughly the same setup, but there the repaints work fine. Reducing our application to something minimal would take days, it is a rather large application. I know you folks can't debug my problem this way :) Nevertheless i hoped for pointers where i might look.


  • Lifetime Qt Champion

    In that case, I would start by re-building the UI adding one piece after the other so you don't go from scratch but check each item until it breaks.


Log in to reply