summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-09-25 07:38:04 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-09-25 07:46:05 (GMT)
commitb12fb5861ce09539c04cd51db12a9bfbe32a4774 (patch)
treebf09d7dc03ca30ca8679e1b008f2ebcf4f7b4322 /src
parentd753ef750d7e0efa1c0b66f3a3cfc0784cc90fa9 (diff)
downloadQt-b12fb5861ce09539c04cd51db12a9bfbe32a4774.zip
Qt-b12fb5861ce09539c04cd51db12a9bfbe32a4774.tar.gz
Qt-b12fb5861ce09539c04cd51db12a9bfbe32a4774.tar.bz2
Change the way we handle KeyboardUIMode on Mac
On Mac OS X, when the keyboard UI mode specifies "text boxes and lists only", the tab key should only focus lists and text edit. The previous implementation was using the focus policy to exclude the buttons. This does not respect the configuration. The change fixes tst_QApplication::focusChanged() with the Keyboard mode "text boxes and lists only". Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnamespace.qdoc4
-rw-r--r--src/gui/kernel/qapplication.cpp20
2 files changed, 17 insertions, 7 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 18b4d67..40dd1d2 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1826,9 +1826,7 @@
\value TabFocus the widget accepts focus by tabbing.
\value ClickFocus the widget accepts focus by clicking.
\value StrongFocus the widget accepts focus by both tabbing
- and clicking. On Mac OS X this will also
- be indicate that the widget accepts tab focus
- when in 'Text/List focus mode'.
+ and clicking.
\value WheelFocus like Qt::StrongFocus plus the widget accepts
focus by using the mouse wheel.
\value NoFocus the widget does not accept focus.
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 774ec23..2ad89a2 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -68,6 +68,9 @@
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qmessagebox.h"
+#include "qlineedit.h"
+#include "qlistview.h"
+#include "qtextedit.h"
#include <QtGui/qgraphicsproxywidget.h>
#include "qinputcontext.h"
@@ -2487,8 +2490,6 @@ void QApplication::setActiveWindow(QWidget* act)
*/
QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next)
{
- uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus;
-
QWidget *f = toplevel->focusWidget();
if (!f)
f = toplevel;
@@ -2496,11 +2497,22 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
QWidget *w = f;
QWidget *test = f->d_func()->focus_next;
while (test && test != f) {
- if ((test->focusPolicy() & focus_flag) == focus_flag
+ if ((test->focusPolicy() & Qt::TabFocus)
&& !(test->d_func()->extra && test->d_func()->extra->focus_proxy)
&& test->isVisibleTo(toplevel) && test->isEnabled()
&& !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
- && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) {
+ && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))
+ && (qt_tab_all_widgets
+#ifndef QT_NO_LINEEDIT
+ || qobject_cast<QLineEdit*>(test)
+#endif
+#ifndef QT_NO_TEXTEDIT
+ || qobject_cast<QTextEdit*>(test)
+#endif
+#ifndef QT_NO_ITEMVIEWS
+ || qobject_cast<QListView*>(test)
+#endif
+ )) {
w = test;
if (next)
break;