Return 0 in QWindow::winId in case of failed platform window creation

Task-number: QTBUG-114613
Change-Id: I93184d95f8f448ab115570a18cdb720449a0637d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 63824363ab4844816a4ea16a4d315c74ae21344a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2023-07-24 13:57:54 +02:00 committed by Qt Cherry-pick Bot
parent 63e7dc7bd6
commit 1a628e82cc

View File

@ -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<QWindow *>(this)->create();
if (!d->platformWindow)
return 0;
return d->platformWindow->winId();
}