|
1 | 1 | #include "proxywindow.hpp" |
2 | 2 |
|
3 | 3 | #include <private/qquickwindow_p.h> |
| 4 | +#include <qcontainerfwd.h> |
4 | 5 | #include <qcoreevent.h> |
5 | 6 | #include <qevent.h> |
6 | 7 | #include <qguiapplication.h> |
@@ -112,6 +113,8 @@ void ProxyWindowBase::ensureQWindow() { |
112 | 113 | auto opaque = this->qsSurfaceFormat.opaqueModified ? this->qsSurfaceFormat.opaque |
113 | 114 | : this->mColor.alpha() >= 255; |
114 | 115 |
|
| 116 | + format.setOption(QSurfaceFormat::ResetNotification); |
| 117 | + |
115 | 118 | if (opaque) format.setAlphaBufferSize(0); |
116 | 119 | else format.setAlphaBufferSize(8); |
117 | 120 |
|
@@ -195,6 +198,7 @@ void ProxyWindowBase::connectWindow() { |
195 | 198 | QObject::connect(this->window, &QWindow::heightChanged, this, &ProxyWindowBase::heightChanged); |
196 | 199 | QObject::connect(this->window, &QWindow::screenChanged, this, &ProxyWindowBase::screenChanged); |
197 | 200 | QObject::connect(this->window, &QQuickWindow::colorChanged, this, &ProxyWindowBase::colorChanged); |
| 201 | + QObject::connect(this->window, &QQuickWindow::sceneGraphError, this, &ProxyWindowBase::onSceneGraphError); |
198 | 202 | QObject::connect(this->window, &ProxiedWindow::exposed, this, &ProxyWindowBase::onExposed); |
199 | 203 | QObject::connect(this->window, &ProxiedWindow::devicePixelRatioChanged, this, &ProxyWindowBase::devicePixelRatioChanged); |
200 | 204 | // clang-format on |
@@ -226,6 +230,22 @@ void ProxyWindowBase::completeWindow() { |
226 | 230 | emit this->screenChanged(); |
227 | 231 | } |
228 | 232 |
|
| 233 | +void ProxyWindowBase::onSceneGraphError( |
| 234 | + QQuickWindow::SceneGraphError error, |
| 235 | + const QString& message |
| 236 | +) { |
| 237 | + if (error == QQuickWindow::ContextNotAvailable) { |
| 238 | + qCritical().nospace() << "Failed to create graphics context for " << this << ": " << message; |
| 239 | + } else { |
| 240 | + qCritical().nospace() << "Scene graph error " << error << " occurred for " << this << ": " |
| 241 | + << message; |
| 242 | + } |
| 243 | + |
| 244 | + emit this->resourcesLost(); |
| 245 | + this->mVisible = false; |
| 246 | + this->setVisibleDirect(false); |
| 247 | +} |
| 248 | + |
229 | 249 | void ProxyWindowBase::onVisibleChanged() { |
230 | 250 | if (this->mVisible && !this->window->isVisible()) { |
231 | 251 | this->mVisible = false; |
|
0 commit comments