diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b59c32ac343..1e30e57baf2 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -687,6 +687,7 @@ void QWindow::create() Returns the window's platform id. \note This function will cause the platform window to be created if it is not already. + Returns 0, if the platform window creation failed. For platforms where this id might be useful, the value returned will uniquely represent the window inside the corresponding screen. @@ -700,6 +701,9 @@ WId QWindow::winId() const if (!d->platformWindow) const_cast(this)->create(); + if (!d->platformWindow) + return 0; + return d->platformWindow->winId(); }