summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-09-18 16:36:16 +0200
committerJason Barron <jbarron@trolltech.com>2009-09-21 10:07:37 +0200
commit789303e0f80a299eb3cfacc1d84dbdc1d3e4abeb (patch)
treef04b58f9917d73ebc77292551e2b139de5f5d73f /src/gui
parentfe55b6083ab6417a83141c719184772d9a375d17 (diff)
Refactor soft keys implementation.
Reviewed-by: Alessandro Portale Squashed commit of the following: commit dae5eda6996d48c12c4a5efd3f6042eb293bacbf Author: Jason Barron <jbarron@trolltech.com> Date: Fri Sep 18 10:32:26 2009 +0200 Only update soft keys when KEYPAD_NAVIGATION is enabled. For 4.6, let's just call these functions when keypad navigation is defined to minimize the impact on other platforms. They should probably get thier own define some day. commit 30a730553531f0f138de5eddb30413936a34fa36 Author: Jason Barron <jbarron@trolltech.com> Date: Fri Sep 18 10:30:23 2009 +0200 Add/remove the menu bar action when menu bar is added/removed. commit a83343a2870b34c228c8bc5e6274607b0e97baf6 Author: Jason Barron <jbarron@trolltech.com> Date: Fri Sep 18 10:28:55 2009 +0200 Compile fix for other platforms commit 39c9e3a0a1d3d62bf6ebd3212cfd2a81b86b9b2a Author: Jason Barron <jbarron@trolltech.com> Date: Thu Sep 17 21:37:59 2009 +0200 Fix 'softkeys' example after API re-factoring. Clean up this example and use the simplified soft key API. Now the actions are only allocated in the constructor and dynamically updated by calling addAction and removeAction. commit 314e45c33f40552db74e61755c2a3b0f8c77a41a Author: Jason Barron <jbarron@trolltech.com> Date: Thu Sep 17 21:30:32 2009 +0200 Re-factor and simplify the soft keys API. Several things here: - Move all the logic into QSoftKeyManager - Move the files into 'kernel' since it is not a widget - Remove QWidget::setSoftKey*(). Use addAction/removeAction instead - Made soft keys update on focus, window activation, and action changes. - Fixed several memory leaks where QAction's were created too often - QAction ownership pushed out to widget's - Added Select/Cancel soft keys for comboboxes and menus to be more consistent to platform look-and-feel. commit fb4c240d970262e9872dc5737df6808879143c75 Author: Jason Barron <jbarron@trolltech.com> Date: Mon Sep 7 15:49:31 2009 +0200 Merge the Symbian implementation with the other platforms nativeMenuBar It seems this has been refactored to share more code across the various platforms that support native menubars so the Symbian code can be mostly removed. commit aa55e4bcd1f009ab35c9519e18aa325fd212dd23 Author: Jason Barron <jbarron@trolltech.com> Date: Wed Aug 26 17:00:34 2009 +0200 Change filenames and move softkey stuff from 'widgets' to 'kernel'. This thing isn't a widget and therefore should not be in the 'widgets' subdirectory of gui. Also rename the files in preparation for refactoring and extending.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp13
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h4
-rw-r--r--src/gui/kernel/kernel.pri6
-rw-r--r--src/gui/kernel/qaction.cpp2
-rw-r--r--src/gui/kernel/qaction.h9
-rw-r--r--src/gui/kernel/qapplication_s60.cpp14
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp260
-rw-r--r--src/gui/kernel/qsoftkeymanager_p.h (renamed from src/gui/widgets/qactiontokeyeventmapper_p.h)34
-rw-r--r--src/gui/kernel/qwidget.cpp80
-rw-r--r--src/gui/kernel/qwidget.h3
-rw-r--r--src/gui/kernel/qwidget_p.h5
-rw-r--r--src/gui/kernel/qwidget_s60.cpp72
-rw-r--r--src/gui/widgets/qactiontokeyeventmapper.cpp103
-rw-r--r--src/gui/widgets/qcombobox.cpp22
-rw-r--r--src/gui/widgets/qcombobox_p.h6
-rw-r--r--src/gui/widgets/qmainwindow.cpp34
-rw-r--r--src/gui/widgets/qmenu.cpp15
-rw-r--r--src/gui/widgets/qmenu_p.h11
-rw-r--r--src/gui/widgets/qmenubar.cpp22
-rw-r--r--src/gui/widgets/widgets.pri6
20 files changed, 387 insertions, 334 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 5c689283bf..8eb5425c89 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -61,7 +61,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
#endif
-#include <private/qactiontokeyeventmapper_p.h>
+#include <private/qsoftkeymanager_p.h>
QT_BEGIN_NAMESPACE
@@ -88,6 +88,9 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
overwrite(false),
dropIndicatorPosition(QAbstractItemView::OnItem),
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ doneSoftKey(0),
+#endif
autoScroll(true),
autoScrollMargin(16),
autoScrollCount(0),
@@ -128,6 +131,10 @@ void QAbstractItemViewPrivate::init()
doDelayedItemsLayout();
q->setAttribute(Qt::WA_InputMethodEnabled);
+
+#ifdef QT_KEYPAD_NAVIGATION
+ doneSoftKey = QSoftKeyManager::createKeyedAction(QAction::EndEditSoftKey, Qt::Key_Back, q);
+#endif
}
void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index)
@@ -2064,14 +2071,14 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (QApplication::keypadNavigationEnabled()) {
if (!hasEditFocus()) {
setEditFocus(true);
- QActionToKeyEventMapper::addSoftKey(QAction::BackSoftKey, Qt::Key_Back, this);
+ addAction(d->doneSoftKey);
return;
}
}
break;
case Qt::Key_Back:
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
- QActionToKeyEventMapper::removeSoftkey(this);
+ removeAction(d->doneSoftKey);
setEditFocus(false);
} else {
event->ignore();
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 6b1ec8e0ea..0bd272d162 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -379,6 +379,10 @@ public:
QAbstractItemView::DropIndicatorPosition dropIndicatorPosition;
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ QAction *doneSoftKey;
+#endif
+
QString keyboardInput;
QTime keyboardInputTime;
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 84898177c0..7cde384f7b 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -46,7 +46,8 @@ HEADERS += \
kernel/qgesture.h \
kernel/qgesture_p.h \
kernel/qstandardgestures.h \
- kernel/qstandardgestures_p.h
+ kernel/qstandardgestures_p.h \
+ kernel/qsoftkeymanager_p.h
SOURCES += \
kernel/qaction.cpp \
@@ -77,7 +78,8 @@ SOURCES += \
kernel/qwidgetaction.cpp \
kernel/qkeymapper.cpp \
kernel/qgesture.cpp \
- kernel/qstandardgestures.cpp
+ kernel/qstandardgestures.cpp \
+ kernel/qsoftkeymanager.cpp
win32 {
DEFINES += QT_NO_DIRECTDRAW
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index c641281fca..549d07ccb1 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -81,7 +81,7 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::OptionsSoftKey),
+ menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
priority(QAction::NormalPriority), iconVisibleInMenu(-1)
{
#ifdef QT3_SUPPORT
diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h
index 59c1765eb2..df56d2cf30 100644
--- a/src/gui/kernel/qaction.h
+++ b/src/gui/kernel/qaction.h
@@ -93,10 +93,11 @@ class Q_GUI_EXPORT QAction : public QObject
public:
enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
AboutRole, PreferencesRole, QuitRole };
- enum SoftKeyRole { OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey, PreviousSoftKey,
- OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey,
- EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey,
- MenuSoftKey, ContextMenuSoftKey, ExitSoftKey };
+ enum SoftKeyRole {
+ NoSoftKey, OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey,
+ PreviousSoftKey, OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey,
+ BackSpaceSoftKey, EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey,
+ FinishSoftKey, MenuSoftKey, ContextMenuSoftKey, ExitSoftKey };
enum Priority { LowPriority = 0,
NormalPriority = 128,
HighPriority = 256};
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 6a381f56dc..a5d07fd67e 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -59,6 +59,7 @@
#include "private/qwindowsurface_s60_p.h"
#include "qpaintengine.h"
#include "private/qmenubar_p.h"
+#include "private/qsoftkeymanager_p.h"
#include "apgwgnam.h" // For CApaWindowGroupName
#include <MdaAudioTonePlayer.h> // For CMdaAudioToneUtility
@@ -1348,17 +1349,12 @@ void QApplication::symbianHandleCommand(int command)
exit();
break;
default:
- if (command >= SOFTKEYSTART && command <= SOFTKEYEND) {
- int index= command-SOFTKEYSTART;
- QWidget *focused = QApplication::focusWidget();
- QWidget *softKeySource = focused ? focused : QApplication::activeWindow();
- const QList<QAction*>& softKeys = softKeySource->softKeys();
- Q_ASSERT(index < softKeys.count());
- softKeys.at(index)->activate(QAction::Trigger);
- }
+ bool handled = QSoftKeyManager::handleCommand(command);
#ifdef Q_WS_S60
- else
+ if (!handled)
QMenuBarPrivate::symbianCommands(command);
+#else
+ Q_UNUSED(handled);
#endif
break;
}
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
new file mode 100644
index 0000000000..b1ebd3806c
--- /dev/null
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qapplication.h"
+#include "qevent.h"
+#ifdef Q_WS_S60
+#include "private/qt_s60_p.h"
+#endif
+#include "private/qsoftkeymanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#ifdef Q_WS_S60
+static const int s60CommandStart = 6000;
+#endif
+
+QWidget *QSoftKeyManager::softKeySource = 0;
+QSoftKeyManager *QSoftKeyManager::self = 0;
+
+const char *QSoftKeyManager::standardSoftKeyText(QAction::SoftKeyRole role)
+{
+ const char *softKeyText = 0;
+ switch (role) {
+ case QAction::OptionsSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Options");
+ break;
+ case QAction::SelectSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Select");
+ break;
+ case QAction::BackSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Back");
+ break;
+ case QAction::NextSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Next");
+ break;
+ case QAction::PreviousSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Previous");
+ break;
+ case QAction::OkSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Ok");
+ break;
+ case QAction::CancelSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Cancel");
+ break;
+ case QAction::EditSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Edit");
+ break;
+ case QAction::ViewSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "View");
+ break;
+ default:
+ ;
+ };
+
+ return softKeyText;
+}
+
+QSoftKeyManager *QSoftKeyManager::instance()
+{
+ if (!QSoftKeyManager::self)
+ QSoftKeyManager::self = new QSoftKeyManager;
+
+ return self;
+}
+
+QSoftKeyManager::QSoftKeyManager() : QObject()
+{
+}
+
+QAction *QSoftKeyManager::createAction(QAction::SoftKeyRole softKeyRole, QWidget *actionWidget)
+{
+ const char* text = standardSoftKeyText(softKeyRole);
+ QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget);
+ action->setSoftKeyRole(softKeyRole);
+ return action;
+}
+
+/*! \internal
+
+ Creates a QAction and registers the 'triggered' signal to send the given key event to
+ \a actionWidget as a convenience.
+
+*/
+QAction *QSoftKeyManager::createKeyedAction(QAction::SoftKeyRole softKeyRole, Qt::Key key, QWidget *actionWidget)
+{
+ QScopedPointer<QAction> action(createAction(softKeyRole, actionWidget));
+
+ connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent()));
+
+ QSoftKeyManager::instance()->keyedActions.insert(action.data(), key);
+ return action.take();
+}
+
+void QSoftKeyManager::sendKeyEvent()
+{
+ QAction *action = qobject_cast<QAction*>(sender());
+
+ if (!action)
+ return;
+
+ Qt::Key keyToSend = keyedActions.value(action, Qt::Key_unknown);
+
+ if (keyToSend != Qt::Key_unknown)
+ QApplication::postEvent(action->parentWidget(),
+ new QKeyEvent(QEvent::KeyPress, keyToSend, Qt::NoModifier));
+}
+
+void QSoftKeyManager::updateSoftKeys(bool force)
+{
+ QList<QAction*> softKeys;
+ QWidget *source = QApplication::focusWidget();
+ do {
+ if (source) {
+ QList<QAction*> actions = source->actions();
+ for (int i = 0; i < actions.count(); ++i) {
+ if (actions.at(i)->softKeyRole() != QAction::NoSoftKey)
+ softKeys.append(actions.at(i));
+ }
+
+ QWidget *parent = source->parentWidget();
+ if (parent && softKeys.isEmpty())
+ source = parent;
+ else
+ break;
+ } else {
+ source = QApplication::activeWindow();
+ }
+ } while (source);
+
+ if (force || (source != QSoftKeyManager::softKeySource)) {
+ QSoftKeyManager::softKeySource = source;
+ QSoftKeyManager::updateSoftKeys_sys(softKeys);
+ }
+}
+
+#ifdef Q_WS_S60
+void QSoftKeyManager::updateSoftKeys_sys(const QList<QAction*> &softkeys)
+{
+
+ CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer();
+ QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS));
+
+ int position = -1;
+ int command;
+ bool needsExitButton = true;
+
+ for (int index = 0; index < softkeys.count(); index++) {
+ const QAction* softKeyAction = softkeys.at(index);
+ switch (softKeyAction->softKeyRole()) {
+ // Positive Actions go on LSK
+ case QAction::OptionsSoftKey:
+ case QAction::MenuSoftKey:
+ case QAction::ContextMenuSoftKey:
+ command = EAknSoftkeyOptions; //Calls DynInitMenuPane in AppUI
+ position = 0;
+ break;
+ case QAction::SelectSoftKey:
+ case QAction::PreviousSoftKey:
+ case QAction::OkSoftKey:
+ case QAction::EditSoftKey:
+ case QAction::ViewSoftKey:
+ case QAction::EndEditSoftKey:
+ case QAction::FinishSoftKey:
+ command = s60CommandStart + index;
+ position = 0;
+ break;
+ // Negative Actions on the RSK
+ case QAction::BackSoftKey:
+ case QAction::NextSoftKey:
+ case QAction::CancelSoftKey:
+ case QAction::BackSpaceSoftKey:
+ case QAction::RevertEditSoftKey:
+ case QAction::DeselectSoftKey:
+ needsExitButton = false;
+ command = s60CommandStart + index;
+ position = 2;
+ break;
+ case QAction::ExitSoftKey:
+ needsExitButton = false;
+ command = EAknSoftkeyExit; //Calls HandleCommand in AppUI
+ position = 2;
+ break;
+ default:
+ break;
+ }
+
+ if (position != -1) {
+ TPtrC text = qt_QString2TPtrC(softKeyAction->text());
+ QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text));
+ }
+ }
+
+ if (needsExitButton)
+ QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))));
+
+ nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
+}
+
+bool QSoftKeyManager::handleCommand(int command)
+{
+ if (command >= s60CommandStart && QSoftKeyManager::softKeySource) {
+ int index = command - s60CommandStart;
+ const QList<QAction*>& softKeys = QSoftKeyManager::softKeySource->actions();
+ if (index < softKeys.count()) {
+ softKeys.at(index)->activate(QAction::Trigger);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+#else
+
+void QSoftKeyManager::updateSoftKeys_sys(const QList<QAction*> &)
+{
+}
+
+#endif
+
+QT_END_NAMESPACE
+
diff --git a/src/gui/widgets/qactiontokeyeventmapper_p.h b/src/gui/kernel/qsoftkeymanager_p.h
index 984eed97bf..630dd9febb 100644
--- a/src/gui/widgets/qactiontokeyeventmapper_p.h
+++ b/src/gui/kernel/qsoftkeymanager_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QACTIONTOKEYEVENTMAPPER_P_H
-#define QACTIONTOKEYEVENTMAPPER_P_H
+#ifndef QSOFTKEYMANAGER_P_H
+#define QSOFTKEYMANAGER_P_H
//
// W A R N I N G
@@ -59,17 +59,31 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QActionToKeyEventMapper : public QObject
+class QSoftKeyManager : public QObject
{
Q_OBJECT
+
public:
- QActionToKeyEventMapper(QAction *softKeyAction, Qt::Key key, QObject *parent);
- static QString roleText(QAction::SoftKeyRole role);
- static void addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget);
- static void removeSoftkey(QWidget *focussedWidget);
+ static void updateSoftKeys(bool force = false);
+ static QAction *createAction(QAction::SoftKeyRole standardRole, QWidget *actionWidget);
+ static QAction *createKeyedAction(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget);
+
+#ifdef Q_WS_S60
+ static bool handleCommand(int);
+#endif
+
private:
- QAction *m_softKeyAction;
- Qt::Key m_key;
+ QSoftKeyManager();
+ static QSoftKeyManager *instance();
+ static const char *standardSoftKeyText(QAction::SoftKeyRole role);
+ static void updateSoftKeys_sys(const QList<QAction*> &softKeys);
+
+ static QSoftKeyManager *self;
+ static QWidget *softKeySource;
+ QHash<QAction*, Qt::Key> keyedActions;
+
+ Q_DISABLE_COPY(QSoftKeyManager)
+
private Q_SLOTS:
void sendKeyEvent();
};
@@ -78,4 +92,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif //QACTIONTOKEYEVENTMAPPER_P_H
+#endif //QSOFTKEYMANAGER_P_H
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 4f1ab94090..461834c16e 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -82,6 +82,7 @@
#include "private/qstyle_p.h"
#include "private/qinputcontext_p.h"
#include "qfileinfo.h"
+#include "private/qsoftkeymanager_p.h"
#if defined (Q_WS_WIN)
# include <private/qwininputcontext_p.h>
@@ -4971,13 +4972,6 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
d->extra->inRenderWithPainter = false;
}
-#if !defined(Q_OS_SYMBIAN)
-void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
-{
- Q_UNUSED(softkeys)
-}
-#endif // !defined(Q_OS_SYMBIAN)
-
/*!
Returns a pointer to this widget's effect if it has one; otherwise 0.
@@ -7997,7 +7991,9 @@ bool QWidget::event(QEvent *event)
}
break;
case QEvent::FocusIn:
- d->setSoftKeys_sys(softKeys());
+#ifdef QT_KEYPAD_NAVIGATION
+ QSoftKeyManager::updateSoftKeys();
+#endif
focusInEvent((QFocusEvent*)event);
break;
@@ -8148,8 +8144,10 @@ bool QWidget::event(QEvent *event)
QApplication::sendEvent(w, event);
}
+#ifdef QT_KEYPAD_NAVIGATION
if (isWindow() && isActiveWindow())
- d->setSoftKeys_sys(softKeys());
+ QSoftKeyManager::updateSoftKeys();
+#endif
break; }
@@ -8258,6 +8256,9 @@ bool QWidget::event(QEvent *event)
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
+#ifdef QT_KEYPAD_NAVIGATION
+ QSoftKeyManager::updateSoftKeys(true);
+#endif
actionEvent((QActionEvent*)event);
break;
#endif
@@ -11938,67 +11939,6 @@ void QWidget::clearMask()
setMask(QRegion());
}
-/*!
- \preliminary
- \since 4.6
-
- Returns the (possibly empty) list of this widget's softkeys.
- Returned list cannot be changed. Softkeys should be added
- and removed via method called setSoftKeys
-
- \sa setSoftKey(), setSoftKeys()
-*/
-const QList<QAction*>& QWidget::softKeys() const
-{
- Q_D(const QWidget);
- if( d->softKeys.count() > 0)
- return d->softKeys;
- if (isWindow() || !parentWidget())
- return d->softKeys;
-
- return parentWidget()->softKeys();
-}
-
-/*!
- \preliminary
- \since 4.6
-
- Sets the softkey \a softKey to this widget's list of softkeys.
- Setting 0 as softkey will clear all the existing softkeys set
- to the widget. A QWidget can have 0 or more softkeys.
-
- \sa softKeys(), setSoftKeys()
-*/
-void QWidget::setSoftKey(QAction *softKey)
-{
- Q_D(QWidget);
- qDeleteAll(d->softKeys);
- d->softKeys.clear();
- if (softKey)
- d->softKeys.append(softKey);
- if ((!QApplication::focusWidget() && this == QApplication::activeWindow())
- || QApplication::focusWidget() == this)
- d->setSoftKeys_sys(this->softKeys());
-}
-
-/*!
- Sets the list of softkeys \a softKeys to this widget's list of softkeys.
- A QWidget can have 0 or more softkeys.
-
- \sa softKeys(), setSoftKey()
-*/
-void QWidget::setSoftKeys(const QList<QAction*> &softKeys)
-{
- Q_D(QWidget);
- qDeleteAll(d->softKeys);
- d->softKeys.clear();
- d->softKeys = softKeys;
-
- if ((!QApplication::focusWidget() && this == QApplication::activeWindow())
- || QApplication::focusWidget() == this)
- d->setSoftKeys_sys(this->softKeys());
-}
-
/*! \fn const QX11Info &QWidget::x11Info() const
Returns information about the configuration of the X display used to display
the widget.
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 84107759a5..7e250e2ea9 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -564,9 +564,6 @@ public:
void removeAction(QAction *action);
QList<QAction*> actions() const;
#endif
- const QList<QAction*>& softKeys() const;
- void setSoftKey(QAction *softKey);
- void setSoftKeys(const QList<QAction*> &softKeys);
QWidget *parentWidget() const;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 5e06c29bfa..5a9c48c300 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -85,9 +85,6 @@
#if defined(Q_OS_SYMBIAN)
class RDrawableWindow;
class CCoeControl;
-// The following 2 defines may only be needed for s60. To be seen.
-const int SOFTKEYSTART=5000;
-const int SOFTKEYEND=5004;
#endif
QT_BEGIN_NAMESPACE
@@ -263,7 +260,6 @@ public:
explicit QWidgetPrivate(int version = QObjectPrivateVersion);
~QWidgetPrivate();
- void setSoftKeys_sys(const QList<QAction*> &softkeys);
QWExtra *extraData() const;
QTLWExtra *topData() const;
QTLWExtra *maybeTopData() const;
@@ -517,7 +513,6 @@ public:
QWidget *focus_next;
QWidget *focus_prev;
QWidget *focus_child;
- QList<QAction*> softKeys;
QLayout *layout;
QRegion *needsFlush;
QPaintDevice *redirectDev;
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 3744377436..4fef0207ca 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -78,78 +78,6 @@ static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
return true;
}
-
-void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
-{
-#ifdef Q_WS_S60
- Q_Q(QWidget);
- if (QApplication::focusWidget() && q!=QApplication::focusWidget()) {
- QList<QAction *> old = QApplication::focusWidget()->softKeys();
- if (isEqual(old, softkeys ))
- return;
- }
- CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer();
- QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS));
-
- int position = -1;
- int command;
- bool needsExitButton = true;
-
- for (int index = 0; index < softkeys.count(); index++) {
- const QAction* softKeyAction = softkeys.at(index);
- switch (softKeyAction->softKeyRole()) {
- // Positive Actions go on LSK
- case QAction::OptionsSoftKey:
- case QAction::MenuSoftKey:
- case QAction::ContextMenuSoftKey:
- command = EAknSoftkeyOptions; //Calls DynInitMenuPane in AppUI
- position = 0;
- break;
- case QAction::SelectSoftKey:
- case QAction::PreviousSoftKey:
- case QAction::OkSoftKey:
- case QAction::EditSoftKey:
- case QAction::ViewSoftKey:
- case QAction::EndEditSoftKey:
- case QAction::FinishSoftKey:
- command = SOFTKEYSTART + index;
- position = 0;
- break;
- // Negative Actions on the RSK
- case QAction::BackSoftKey:
- case QAction::NextSoftKey:
- case QAction::CancelSoftKey:
- case QAction::BackSpaceSoftKey:
- case QAction::RevertEditSoftKey:
- case QAction::DeselectSoftKey:
- needsExitButton = false;
- command = SOFTKEYSTART + index;
- position = 2;
- break;
- case QAction::ExitSoftKey:
- needsExitButton = false;
- command = EAknSoftkeyExit; //Calls HandleCommand in AppUI
- position = 2;
- break;
- default:
- break;
- }
-
- if (position != -1) {
- TPtrC text = qt_QString2TPtrC(softKeyAction->text());
- QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text));
- }
- }
-
- if (needsExitButton)
- QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))));
-
- nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
-#else
- Q_UNUSED(softkeys)
-#endif
-}
-
void QWidgetPrivate::setWSGeometry(bool /* dontShow */, const QRect & /* rect */)
{
diff --git a/src/gui/widgets/qactiontokeyeventmapper.cpp b/src/gui/widgets/qactiontokeyeventmapper.cpp
deleted file mode 100644
index 171b82d50f..0000000000
--- a/src/gui/widgets/qactiontokeyeventmapper.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-#include "qevent.h"
-#include "qactiontokeyeventmapper_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QActionToKeyEventMapper::QActionToKeyEventMapper(QAction *softKeyAction, Qt::Key key, QObject *parent)
- : QObject(parent)
- , m_softKeyAction(softKeyAction)
- , m_key(key)
-{
-
-}
-
-QString QActionToKeyEventMapper::roleText(QAction::SoftKeyRole role)
-{
- switch (role) {
- case QAction::OptionsSoftKey:
- return QAction::tr("Options");
- case QAction::SelectSoftKey:
- return QAction::tr("Select");
- case QAction::BackSoftKey:
- return QAction::tr("Back");
- case QAction::NextSoftKey:
- return QAction::tr("Next");
- case QAction::PreviousSoftKey:
- return QAction::tr("Previous");
- case QAction::OkSoftKey:
- return QAction::tr("Ok");
- case QAction::CancelSoftKey:
- return QAction::tr("Cancel");
- case QAction::EditSoftKey:
- return QAction::tr("Edit");
- case QAction::ViewSoftKey:
- return QAction::tr("View");
- default:
- return QString();
- };
-}
-void QActionToKeyEventMapper::addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget)
-{
- QAction *action = new QAction(actionWidget);
- action->setSoftKeyRole(standardRole);
- action->setText(roleText(standardRole));
- QActionToKeyEventMapper *softKey = new QActionToKeyEventMapper(action, key, actionWidget);
- connect(action, SIGNAL(triggered()), softKey, SLOT(sendKeyEvent()));
- connect(action, SIGNAL(destroyed()), softKey, SLOT(deleteLater()));
- actionWidget->setSoftKey(action);
-}
-
-void QActionToKeyEventMapper::removeSoftkey(QWidget *focussedWidget)
-{
- focussedWidget->setSoftKey(0);
-}
-
-void QActionToKeyEventMapper::sendKeyEvent()
-{
- QApplication::postEvent(parent(), new QKeyEvent(QEvent::KeyPress, m_key, Qt::NoModifier));
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 220f04eb1a..0d710c419e 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -63,8 +63,8 @@
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
+#include <private/qsoftkeymanager_p.h>
#include <qdebug.h>
-#include <private/qactiontokeyeventmapper_p.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
#endif
@@ -402,6 +402,13 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView
layout->setSpacing(0);
layout->setMargin(0);
+#ifdef QT_KEYPAD_NAVIGATION
+ selectAction = QSoftKeyManager::createKeyedAction(QAction::SelectSoftKey, Qt::Key_Select, itemView);
+ cancelAction = QSoftKeyManager::createKeyedAction(QAction::CancelSoftKey, Qt::Key_Escape, itemView);
+ addAction(selectAction);
+ addAction(cancelAction);
+#endif
+
// set item view
setItemView(itemView);
@@ -564,6 +571,11 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
this, SLOT(setCurrentIndex(QModelIndex)));
connect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
+
+#ifdef QT_KEYPAD_NAVIGATION
+ selectAction->setParent(itemView);
+ cancelAction->setParent(itemView);
+#endif
}
/*!
@@ -629,9 +641,6 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Select:
#endif
if (view->currentIndex().isValid() && (view->currentIndex().flags() & Qt::ItemIsEnabled) ) {
-#ifdef QT_KEYPAD_NAVIGATION
- QActionToKeyEventMapper::removeSoftkey(this);
-#endif
combo->hidePopup();
emit itemSelected(view->currentIndex());
}
@@ -642,10 +651,6 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
// fall through
case Qt::Key_F4:
case Qt::Key_Escape:
-#ifdef QT_KEYPAD_NAVIGATION
- case Qt::Key_Back:
- QActionToKeyEventMapper::removeSoftkey(this);
-#endif
combo->hidePopup();
return true;
default:
@@ -2477,7 +2482,6 @@ void QComboBox::showPopup()
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
view()->setEditFocus(true);
- QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, view());
#endif
}
diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h
index 507820cfe3..cd0861d314 100644
--- a/src/gui/widgets/qcombobox_p.h
+++ b/src/gui/widgets/qcombobox_p.h
@@ -78,6 +78,8 @@
QT_BEGIN_NAMESPACE
+class QAction;
+
class QComboBoxListView : public QListView
{
Q_OBJECT
@@ -253,6 +255,10 @@ private:
QAbstractItemView *view;
QComboBoxPrivateScroller *top;
QComboBoxPrivateScroller *bottom;
+#ifdef QT_KEYPAD_NAVIGATION
+ QAction *selectAction;
+ QAction *cancelAction;
+#endif
};
class QComboMenuDelegate : public QAbstractItemDelegate
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 990d82160a..17645cd017 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -65,6 +65,9 @@ QT_BEGIN_NAMESPACE
extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp
QT_END_NAMESPACE
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+#include <private/qsoftkeymanager_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -77,6 +80,9 @@ public:
#ifdef Q_WS_MAC
, useHIToolBar(false)
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ , menuBarAction(0)
+#endif
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
, hasOldCursor(false) , cursorAdjusted(false)
#endif
@@ -88,6 +94,9 @@ public:
#ifdef Q_WS_MAC
bool useHIToolBar;
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ QAction *menuBarAction;
+#endif
void init();
QList<int> hoverSeparator;
QPoint hoverPos;
@@ -108,6 +117,9 @@ void QMainWindowPrivate::init()
const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
iconSize = QSize(metric, metric);
q->setAttribute(Qt::WA_Hover);
+#ifdef QT_KEYPAD_NAVIGATION
+ menuBarAction = QSoftKeyManager::createAction(QAction::MenuSoftKey, q);
+#endif
}
/*
@@ -479,11 +491,13 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar)
oldMenuBar->deleteLater();
}
d->layout->setMenuBar(menuBar);
- if (menuBar) {
- QAction* menu = new QAction(QString::fromLatin1("Options"), this);
- menu->setSoftKeyRole(QAction::MenuSoftKey);
- setSoftKey(menu);
- }
+
+#ifdef QT_KEYPAD_NAVIGATION
+ if (menuBar)
+ addAction(d->menuBarAction);
+ else
+ removeAction(d->menuBarAction);
+#endif
}
/*!
@@ -1412,16 +1426,6 @@ bool QMainWindow::event(QEvent *event)
}
break;
#endif
-#ifndef QT_NO_MENUBAR
- case QEvent::WindowActivate:
- if (d->layout->menuBar()) {
- // ### TODO: This is evil, there is no need to create a new action every time
- QAction* menu = new QAction(QString::fromLatin1("Options"), this);
- menu->setSoftKeyRole(QAction::MenuSoftKey);
- setSoftKey(menu);
- }
- break;
-#endif
default:
break;
}
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 925be02145..5e511559eb 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -60,13 +60,13 @@
#ifndef QT_NO_WHATSTHIS
# include <qwhatsthis.h>
#endif
-#include <private/qactiontokeyeventmapper_p.h>
#include "qmenu_p.h"
#include "qmenubar_p.h"
#include "qwidgetaction.h"
#include "qtoolbutton.h"
#include <private/qaction_p.h>
+#include <private/qsoftkeymanager_p.h>
#ifdef QT3_SUPPORT
#include <qmenudata.h>
#endif // QT3_SUPPORT
@@ -162,6 +162,15 @@ void QMenuPrivate::init()
scroll = new QMenuPrivate::QMenuScroller;
scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
}
+
+#ifdef QT_KEYPAD_NAVIGATION
+ selectAction = QSoftKeyManager::createKeyedAction(QAction::SelectSoftKey, Qt::Key_Select, q);
+ cancelAction = QSoftKeyManager::createKeyedAction(QAction::CancelSoftKey, Qt::Key_Back, q);
+ selectAction->setVisible(false); // Don't show these in the menu
+ cancelAction->setVisible(false);
+ q->addAction(selectAction);
+ q->addAction(cancelAction);
+#endif
}
int QMenuPrivate::scrollerHeight() const
@@ -1926,9 +1935,6 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::PopupMenuStart);
#endif
-#ifdef QT_KEYPAD_NAVIGATION
- QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, this);
-#endif
}
/*!
@@ -2587,7 +2593,6 @@ void QMenu::keyPressEvent(QKeyEvent *e)
case Qt::Key_Escape:
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Back:
- QActionToKeyEventMapper::removeSoftkey(this);
#endif
key_consumed = true;
if (d->tornoff) {
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index 33b892a607..2d5632ebbe 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -139,7 +139,12 @@ class QMenuPrivate : public QWidgetPrivate
public:
QMenuPrivate() : itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
collapsibleSeparators(true), activationRecursionGuard(false), hasHadMouse(0), aboutToHide(0), motions(0),
- currentAction(0), scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
+ currentAction(0),
+#ifdef QT_KEYPAD_NAVIGATION
+ selectAction(0),
+ cancelAction(0),
+#endif
+ scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
hasCheckableItems(0), sloppyAction(0), doChildEffects(false)
#ifdef Q_WS_MAC
,mac_menu(0)
@@ -193,6 +198,10 @@ public:
uint aboutToHide : 1;
int motions;
QAction *currentAction;
+#ifdef QT_KEYPAD_NAVIGATION
+ QAction *selectAction;
+ QAction *cancelAction;
+#endif
static QBasicTimer menuDelayTimer;
enum SelectionReason {
SelectedFromKeyboard,
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 7b0f37e7c5..13e7de4fd2 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -1072,16 +1072,10 @@ void QMenuBar::paintEvent(QPaintEvent *e)
*/
void QMenuBar::setVisible(bool visible)
{
-#if defined(Q_WS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
if (isNativeMenuBar())
return;
#endif
-#ifdef Q_WS_S60
- Q_D(QMenuBar);
- if(d->symbian_menubar)
- return;
-#endif
-
QWidget::setVisible(visible);
}
@@ -1278,10 +1272,12 @@ void QMenuBar::actionEvent(QActionEvent *e)
{
Q_D(QMenuBar);
d->itemsDirty = true;
-#if defined (Q_WS_MAC) || defined(Q_OS_WINCE)
+#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
if (isNativeMenuBar()) {
#ifdef Q_WS_MAC
QMenuBarPrivate::QMacMenuBarPrivate *nativeMenuBar = d->mac_menubar;
+#elif defined(Q_WS_S60)
+ QMenuBarPrivate::QSymbianMenuBarPrivate *nativeMenuBar = d->symbian_menubar;
#else
QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar;
#endif
@@ -1295,16 +1291,6 @@ void QMenuBar::actionEvent(QActionEvent *e)
nativeMenuBar->syncAction(e->action());
}
#endif
-#ifdef Q_WS_S60
- if(d->symbian_menubar) {
- if(e->type() == QEvent::ActionAdded)
- d->symbian_menubar->addAction(e->action(), d->symbian_menubar->findAction(e->before()));
- else if(e->type() == QEvent::ActionRemoved)
- d->symbian_menubar->removeAction(e->action());
- else if(e->type() == QEvent::ActionChanged)
- d->symbian_menubar->syncAction(e->action());
- }
-#endif
if(e->type() == QEvent::ActionAdded) {
connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered()));
diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri
index 45679025b6..6883dd8219 100644
--- a/src/gui/widgets/widgets.pri
+++ b/src/gui/widgets/widgets.pri
@@ -81,8 +81,7 @@ HEADERS += \
widgets/qtoolbararealayout_p.h \
widgets/qplaintextedit.h \
widgets/qplaintextedit_p.h \
- widgets/qprintpreviewwidget.h \
- widgets/qactiontokeyeventmapper_p.h
+ widgets/qprintpreviewwidget.h
SOURCES += \
widgets/qabstractbutton.cpp \
widgets/qabstractslider.cpp \
@@ -143,8 +142,7 @@ SOURCES += \
widgets/qwidgetanimator.cpp \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp \
- widgets/qprintpreviewwidget.cpp \
- widgets/qactiontokeyeventmapper.cpp
+ widgets/qprintpreviewwidget.cpp
!embedded:mac {
HEADERS += widgets/qmacnativewidget_mac.h \