diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qactiontokeyeventmapper.cpp (renamed from src/gui/widgets/qkeyeventsoftkey.cpp) | 16 | ||||
-rw-r--r-- | src/gui/widgets/qactiontokeyeventmapper_p.h (renamed from src/gui/widgets/qkeyeventsoftkey.h) | 14 | ||||
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/widgets.pri | 4 |
5 files changed, 22 insertions, 28 deletions
diff --git a/src/gui/widgets/qkeyeventsoftkey.cpp b/src/gui/widgets/qactiontokeyeventmapper.cpp index f5f10fc..5cce415 100644 --- a/src/gui/widgets/qkeyeventsoftkey.cpp +++ b/src/gui/widgets/qactiontokeyeventmapper.cpp @@ -41,11 +41,11 @@ #include "qapplication.h" #include "qevent.h" -#include "qkeyeventsoftkey.h" +#include "QActionToKeyEventMapper_p.h" QT_BEGIN_NAMESPACE -QKeyEventSoftKey::QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject *parent) +QActionToKeyEventMapper::QActionToKeyEventMapper(QAction *softKeyAction, Qt::Key key, QObject *parent) : QObject(parent) , m_softKeyAction(softKeyAction) , m_key(key) @@ -53,7 +53,7 @@ QKeyEventSoftKey::QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject } -QString QKeyEventSoftKey::roleText(QAction::SoftKeyRole role) +QString QActionToKeyEventMapper::roleText(QAction::SoftKeyRole role) { switch (role) { case QAction::OptionsSoftKey: @@ -78,28 +78,26 @@ QString QKeyEventSoftKey::roleText(QAction::SoftKeyRole role) return QString(); }; } -void QKeyEventSoftKey::addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget) +void QActionToKeyEventMapper::addSoftKey(QAction::SoftKeyRole standardRole, Qt::Key key, QWidget *actionWidget) { QAction *action = new QAction(actionWidget); action->setSoftKeyRole(standardRole); action->setText(roleText(standardRole)); - QKeyEventSoftKey *softKey = new QKeyEventSoftKey(action, key, actionWidget); + 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 QKeyEventSoftKey::removeSoftkey(QWidget *focussedWidget) +void QActionToKeyEventMapper::removeSoftkey(QWidget *focussedWidget) { focussedWidget->setSoftKey(0); } -void QKeyEventSoftKey::sendKeyEvent() +void QActionToKeyEventMapper::sendKeyEvent() { QApplication::postEvent(parent(), new QKeyEvent(QEvent::KeyPress, m_key, Qt::NoModifier)); } QT_END_NAMESPACE -#include "moc_qkeyeventsoftkey.cpp" - diff --git a/src/gui/widgets/qkeyeventsoftkey.h b/src/gui/widgets/qactiontokeyeventmapper_p.h index 0b95efb..da336e8 100644 --- a/src/gui/widgets/qkeyeventsoftkey.h +++ b/src/gui/widgets/qactiontokeyeventmapper_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QKEYEVENTSOFTKEY_H -#define QKEYEVENTSOFTKEY_H +#ifndef QACTIONTOKEYEVENTMAPPER_P_H +#define QACTIONTOKEYEVENTMAPPER_P_H #include <QtCore/qobject.h> #include "QtGui/qaction.h" @@ -48,15 +48,11 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - - - -class Q_GUI_EXPORT QKeyEventSoftKey : QObject +class QActionToKeyEventMapper : public QObject { Q_OBJECT public: - QKeyEventSoftKey(QAction *softKeyAction, Qt::Key key, QObject *parent); + 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); @@ -71,4 +67,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif //QKEYEVENSOFTKEY_H +#endif //QACTIONTOKEYEVENTMAPPER_H diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 01fcf34..2da5cd0 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -63,7 +63,7 @@ #include <private/qabstractitemmodel_p.h> #include <private/qabstractscrollarea_p.h> #include <qdebug.h> -#include <qkeyeventsoftkey.h> +#include <qactiontokeyeventmapper_p.h> #ifdef Q_WS_X11 #include <private/qt_x11_p.h> #endif @@ -629,7 +629,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) #endif if (view->currentIndex().isValid() && (view->currentIndex().flags() & Qt::ItemIsEnabled) ) { #ifdef QT_KEYPAD_NAVIGATION - QKeyEventSoftKey::removeSoftkey(this); + QActionToKeyEventMapper::removeSoftkey(this); #endif combo->hidePopup(); emit itemSelected(view->currentIndex()); @@ -643,7 +643,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) case Qt::Key_Escape: #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Back: - QKeyEventSoftKey::removeSoftkey(this); + QActionToKeyEventMapper::removeSoftkey(this); #endif combo->hidePopup(); return true; @@ -2438,7 +2438,7 @@ void QComboBox::showPopup() #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled()) view()->setEditFocus(true); - QKeyEventSoftKey::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, view()); + QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, view()); #endif } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index d713081..3486574 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -60,7 +60,7 @@ #ifndef QT_NO_WHATSTHIS # include <qwhatsthis.h> #endif -#include <qkeyeventsoftkey.h> +#include <qactiontokeyeventmapper_p.h> #include "qmenu_p.h" #include "qmenubar_p.h" @@ -584,7 +584,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason #ifdef QT_KEYPAD_NAVIGATION // TODO: aportale, remove KEYPAD_NAVIGATION_HACK when softkey stack // handles focus related and user related actions separately... - QKeyEventSoftKey::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, q); + QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, q); #endif } } @@ -1945,7 +1945,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) QAccessible::updateAccessibility(this, 0, QAccessible::PopupMenuStart); #endif #ifdef QT_KEYPAD_NAVIGATION - QKeyEventSoftKey::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, this); + QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, this); #endif } @@ -2597,7 +2597,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) case Qt::Key_Escape: #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Back: - QKeyEventSoftKey::removeSoftkey(this); + QActionToKeyEventMapper::removeSoftkey(this); #endif key_consumed = true; if (d->tornoff) { diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri index f395c76..9e226e2 100644 --- a/src/gui/widgets/widgets.pri +++ b/src/gui/widgets/widgets.pri @@ -79,7 +79,7 @@ HEADERS += \ widgets/qplaintextedit.h \ widgets/qplaintextedit_p.h \ widgets/qprintpreviewwidget.h \ - widgets/qkeyeventsoftkey.h + widgets/qactiontokeyeventmapper_p.h SOURCES += \ widgets/qabstractbutton.cpp \ widgets/qabstractslider.cpp \ @@ -139,7 +139,7 @@ SOURCES += \ widgets/qtoolbararealayout.cpp \ widgets/qplaintextedit.cpp \ widgets/qprintpreviewwidget.cpp \ - widgets/qkeyeventsoftkey.cpp + widgets/qactiontokeyeventmapper.cpp !embedded:mac { HEADERS += widgets/qmacnativewidget_mac.h \ |