diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-09-19 17:12:10 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-09-21 08:07:39 (GMT) |
commit | 6248dff2c7f3288d675de639abfbbc6c1d618006 (patch) | |
tree | 11c8a736b8b2b3a8fd474225cab630370f369d57 /src/gui | |
parent | 789303e0f80a299eb3cfacc1d84dbdc1d3e4abeb (diff) | |
download | Qt-6248dff2c7f3288d675de639abfbbc6c1d618006.zip Qt-6248dff2c7f3288d675de639abfbbc6c1d618006.tar.gz Qt-6248dff2c7f3288d675de639abfbbc6c1d618006.tar.bz2 |
Give the soft key functionality it's own macro.
Re-using QT_KEYPAD_NAVIGATION for soft keys is wrong since the two
are independant concepts. This puts everything in a new macro called
QT_SOFTKEYS_ENABLED. This will also insulate the embedded customers
who use keypad navigation from the soft key changes.
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 8 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractitemview_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qcombobox_p.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 10 |
6 files changed, 18 insertions, 14 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 8eb5425..715f92d 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -88,7 +88,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() overwrite(false), dropIndicatorPosition(QAbstractItemView::OnItem), #endif -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED doneSoftKey(0), #endif autoScroll(true), @@ -132,7 +132,7 @@ void QAbstractItemViewPrivate::init() q->setAttribute(Qt::WA_InputMethodEnabled); -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED doneSoftKey = QSoftKeyManager::createKeyedAction(QAction::EndEditSoftKey, Qt::Key_Back, q); #endif } @@ -2071,14 +2071,18 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) if (QApplication::keypadNavigationEnabled()) { if (!hasEditFocus()) { setEditFocus(true); +#ifdef QT_SOFTKEYS_ENABLED addAction(d->doneSoftKey); +#endif return; } } break; case Qt::Key_Back: if (QApplication::keypadNavigationEnabled() && hasEditFocus()) { +#ifdef QT_SOFTKEYS_ENABLED removeAction(d->doneSoftKey); +#endif setEditFocus(false); } else { event->ignore(); diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 0bd272d..84c0892 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -379,7 +379,7 @@ public: QAbstractItemView::DropIndicatorPosition dropIndicatorPosition; #endif -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED QAction *doneSoftKey; #endif diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 461834c..41d0b23 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -7991,7 +7991,7 @@ bool QWidget::event(QEvent *event) } break; case QEvent::FocusIn: -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED QSoftKeyManager::updateSoftKeys(); #endif focusInEvent((QFocusEvent*)event); @@ -8144,7 +8144,7 @@ bool QWidget::event(QEvent *event) QApplication::sendEvent(w, event); } -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED if (isWindow() && isActiveWindow()) QSoftKeyManager::updateSoftKeys(); #endif @@ -8256,7 +8256,7 @@ bool QWidget::event(QEvent *event) case QEvent::ActionAdded: case QEvent::ActionRemoved: case QEvent::ActionChanged: -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED QSoftKeyManager::updateSoftKeys(true); #endif actionEvent((QActionEvent*)event); diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 0d710c4..2f79600 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -402,7 +402,7 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView layout->setSpacing(0); layout->setMargin(0); -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED selectAction = QSoftKeyManager::createKeyedAction(QAction::SelectSoftKey, Qt::Key_Select, itemView); cancelAction = QSoftKeyManager::createKeyedAction(QAction::CancelSoftKey, Qt::Key_Escape, itemView); addAction(selectAction); @@ -572,7 +572,7 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) connect(view, SIGNAL(destroyed()), this, SLOT(viewDestroyed())); -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED selectAction->setParent(itemView); cancelAction->setParent(itemView); #endif diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index cd0861d..f7458c4 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -255,7 +255,7 @@ private: QAbstractItemView *view; QComboBoxPrivateScroller *top; QComboBoxPrivateScroller *bottom; -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED QAction *selectAction; QAction *cancelAction; #endif diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 17645cd..8a39a48 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp QT_END_NAMESPACE #endif -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED #include <private/qsoftkeymanager_p.h> #endif @@ -80,7 +80,7 @@ public: #ifdef Q_WS_MAC , useHIToolBar(false) #endif -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED , menuBarAction(0) #endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) @@ -94,7 +94,7 @@ public: #ifdef Q_WS_MAC bool useHIToolBar; #endif -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED QAction *menuBarAction; #endif void init(); @@ -117,7 +117,7 @@ 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 +#ifdef QT_SOFTKEYS_ENABLED menuBarAction = QSoftKeyManager::createAction(QAction::MenuSoftKey, q); #endif } @@ -492,7 +492,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) } d->layout->setMenuBar(menuBar); -#ifdef QT_KEYPAD_NAVIGATION +#ifdef QT_SOFTKEYS_ENABLED if (menuBar) addAction(d->menuBarAction); else |