return true;
}
+/*!
+ Stop rendering and release resources. This function is typically
+ called when the window is hidden. Requires a current context.
+ */
+void QQuickRenderControl::stop()
+{
+ Q_D(QQuickRenderControl);
+ if (!d->window)
+ return;
+
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
+ cd->fireAboutToStop();
+ cd->cleanupNodesOnShutdown();
+
+ if (!cd->persistentSceneGraph) {
+ d->rc->invalidate();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ }
+}
+
/*!
Render the scenegraph using the current context.
*/
d->offscreenWindow->mouseDoubleClickEvent(&mappedEvent);
}
-void QQuickWidget::showEvent(QShowEvent *e)
+void QQuickWidget::showEvent(QShowEvent *)
{
Q_D(QQuickWidget);
QQuickWindowPrivate::get(d->offscreenWindow)->forceRendering = true;
- d->offscreenWindow->showEvent(e);
+
+ d->updatePending = false;
+ triggerUpdate();
}
-void QQuickWidget::hideEvent(QHideEvent *e)
+void QQuickWidget::hideEvent(QHideEvent *)
{
Q_D(QQuickWidget);
QQuickWindowPrivate::get(d->offscreenWindow)->forceRendering = false;
- d->offscreenWindow->hideEvent(e);
+
+ QOpenGLContext *context = d->offscreenWindow->openglContext();
+ if (!context) {
+ qWarning("QQuickWidget::hideEvent with no context");
+ return;
+ }
+ context->makeCurrent(d->offscreenWindow);
+ d->renderControl->stop();
}
/*! \reimp */