QAccessibleWidget: Retrieve window from native parent widget.

Query the native parent widget if the widget does not have a window handle.
The window is required to be able to determine the correct
scale factor for the screen when High DPI scaling is active.

Change-Id: Ibaf5e8e7b07327ea635d2f726acea76c2c95bda3
Task-number: QTBUG-52943
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2016-05-06 11:20:49 +02:00
parent ee51638187
commit 558c5c849c

View File

@ -206,8 +206,14 @@ bool QAccessibleWidget::isValid() const
/*! \reimp */
QWindow *QAccessibleWidget::window() const
{
Q_ASSERT(widget());
return widget()->windowHandle();
const QWidget *w = widget();
Q_ASSERT(w);
QWindow *result = w->windowHandle();
if (!result) {
if (const QWidget *nativeParent = w->nativeParentWidget())
result = nativeParent->windowHandle();
}
return result;
}
/*!