From b3e18be580bc5eceea00594a62759566b1546d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Thu, 19 Jan 2012 16:15:31 +0100 Subject: Activate window when focus is set in QAccessibleWidget::doAction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iebdabb30c83d4712ad75ec62ce35b4afc382b613 Reviewed-by: Jan-Arve Sæther --- src/gui/accessible/qaccessiblewidget.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 832f6c8..beb251b 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -888,12 +888,15 @@ bool QAccessibleWidget::doAction(int action, int child, const QVariantList ¶ if (action == SetFocus || action == DefaultAction) { if (child || !widget()->isEnabled()) return false; - if (widget()->focusPolicy() != Qt::NoFocus) - widget()->setFocus(); - else if (widget()->isWindow()) - widget()->activateWindow(); - else + + if ((widget()->focusPolicy() == Qt::NoFocus) && (!widget()->isWindow())) return false; + + if (!widget()->isWindow()) + widget()->setFocus(); + + widget()->activateWindow(); + return true; } else if (action > 0) { if (QAction *act = widget()->actions().value(action - 1)) { -- cgit v0.12