summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlessandro Portale <aportale@trolltech.com>2009-05-29 16:33:30 (GMT)
committerAlessandro Portale <aportale@trolltech.com>2009-05-29 16:33:30 (GMT)
commitafef05497be340509ffb604ab23d7d036bc363ea (patch)
tree90d976389d342f481a00ccb06930b7444da77ae4 /src
parentdc599015e702320cbb868855ba76f37d264dc074 (diff)
downloadQt-afef05497be340509ffb604ab23d7d036bc363ea.zip
Qt-afef05497be340509ffb604ab23d7d036bc363ea.tar.gz
Qt-afef05497be340509ffb604ab23d7d036bc363ea.tar.bz2
Implemented QKeyEventSoftKey::removeSoftkey and using it in
QAbstractItemView::keyPressEvent to remove the "Back" key.
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp3
-rw-r--r--src/gui/widgets/qsoftkeystack.cpp11
-rw-r--r--src/gui/widgets/qsoftkeystack_p.h1
3 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 6e24c85..565bc28 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2013,8 +2013,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
break;
case Qt::Key_Back:
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
- if (QSoftKeyStack *stack = QSoftKeyStack::softKeyStackOfWidget(this))
- stack->pop();
+ QKeyEventSoftKey::removeSoftkey(this);
setEditFocus(false);
} else {
event->ignore();
diff --git a/src/gui/widgets/qsoftkeystack.cpp b/src/gui/widgets/qsoftkeystack.cpp
index 0c5648e..db9b7a2 100644
--- a/src/gui/widgets/qsoftkeystack.cpp
+++ b/src/gui/widgets/qsoftkeystack.cpp
@@ -284,7 +284,16 @@ void QKeyEventSoftKey::addSoftKey(QSoftKeyAction::StandardRole standardRole, Qt:
QSoftKeyAction *action = new QSoftKeyAction(standardRole, actionWidget);
QKeyEventSoftKey *softKey = new QKeyEventSoftKey(action, key, actionWidget);
connect(action, SIGNAL(triggered()), softKey, SLOT(sendKeyEvent()));
- stack->push(action);
+ stack->popandPush(action);
+}
+
+void QKeyEventSoftKey::removeSoftkey(QWidget *focussedWidget)
+{
+ QSoftKeyStack *stack = QSoftKeyStack::softKeyStackOfWidget(focussedWidget);
+ if (!stack)
+ return;
+ QList<QSoftKeyAction*> actionList = menuActionList(focussedWidget);
+ stack->popandPush(actionList);
}
void QKeyEventSoftKey::sendKeyEvent()
diff --git a/src/gui/widgets/qsoftkeystack_p.h b/src/gui/widgets/qsoftkeystack_p.h
index 75d7ad4..c9d7f8d 100644
--- a/src/gui/widgets/qsoftkeystack_p.h
+++ b/src/gui/widgets/qsoftkeystack_p.h
@@ -98,6 +98,7 @@ class QKeyEventSoftKey : QObject
public:
QKeyEventSoftKey(QSoftKeyAction *softKeyAction, Qt::Key key, QObject *parent);
static void addSoftKey(QSoftKeyAction::StandardRole standardRole, Qt::Key key, QWidget *actionWidget);
+ static void removeSoftkey(QWidget *focussedWidget);
private:
QSoftKeyAction *m_softKeyAction;
Qt::Key m_key;