From c360fbcd6c9276b8a3fa8a200fa489b7b69e3aaa Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 22 Oct 2012 13:48:59 +0200 Subject: Do the actual removal of the Soft Keys API and related code In addition to the actual removal of the softkeys API in QAction, this commit removes some enums related to the softkeys feature: Qt::WA_MergeSoftkeys Qt::WA_MergeSoftkeysRecursively It also removes some "zombie" enums: Qt::WindowSoftkeysVisibleHint = 0x40000000, Qt::WindowSoftkeysRespondHint = 0x80000000, (The only implementation that used these were removed when qapplication_s60.cpp and qwidget_s60.cpp were removed.) Change-Id: Ib6fc6d543def4757383d5f19256199d9d190c614 Reviewed-by: Lars Knoll Reviewed-by: Janne Anttila Reviewed-by: J-P Nurmi --- src/widgets/widgets/qcombobox.cpp | 13 --- src/widgets/widgets/qcombobox_p.h | 4 - src/widgets/widgets/qdialogbuttonbox.cpp | 134 ------------------------------- src/widgets/widgets/qmenu.cpp | 23 ------ src/widgets/widgets/qmenubar.cpp | 12 --- src/widgets/widgets/qmenubar_p.h | 3 - 6 files changed, 189 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index ef908d62c6..f22fc196a2 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -64,7 +64,6 @@ #include #include #include -#include #include #if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC) #include @@ -561,13 +560,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) #endif connect(view, SIGNAL(destroyed()), this, SLOT(viewDestroyed())); - -#ifdef QT_SOFTKEYS_ENABLED - selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView); - cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView); - addAction(selectAction); - addAction(cancelAction); -#endif } /*! @@ -617,11 +609,6 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e) view->setMouseTracking(combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) || combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)); setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo)); -#ifdef QT_SOFTKEYS_ENABLED - } else if (e->type() == QEvent::LanguageChange) { - selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey)); - cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey)); -#endif } QWidget::changeEvent(e); diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index eaf218283d..c51e6bb388 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -254,10 +254,6 @@ private: QAbstractItemView *view; QComboBoxPrivateScroller *top; QComboBoxPrivateScroller *bottom; -#ifdef QT_SOFTKEYS_ENABLED - QAction *selectAction; - QAction *cancelAction; -#endif }; class QComboMenuDelegate : public QAbstractItemDelegate diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index d25332a077..f20fc522ba 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -255,31 +255,6 @@ static const uint layouts[2][5][14] = } }; -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) -class QDialogButtonEnabledProxy : public QObject -{ -public: - QDialogButtonEnabledProxy(QObject *parent, QWidget *src, QAction *trg) : QObject(parent), source(src), target(trg) - { - source->installEventFilter(this); - target->setEnabled(source->isEnabled()); - } - ~QDialogButtonEnabledProxy() - { - source->removeEventFilter(this); - } - bool eventFilter(QObject *object, QEvent *event) - { - if (object == source && event->type() == QEvent::EnabledChange) { - target->setEnabled(source->isEnabled()); - } - return false; - }; -private: - QWidget *source; - QAction *target; -}; -#endif class QDialogButtonBoxPrivate : public QWidgetPrivate { @@ -290,9 +265,6 @@ public: QList buttonLists[QDialogButtonBox::NRoles]; QHash standardButtonHash; -#ifdef QT_SOFTKEYS_ENABLED - QHash softKeyActions; -#endif Qt::Orientation orientation; QDialogButtonBox::ButtonLayout layoutPolicy; @@ -312,9 +284,6 @@ public: void addButtonsToLayout(const QList &buttonList, bool reverse); void retranslateStrings(); const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const; -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) - QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role); -#endif }; QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient) @@ -577,62 +546,10 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked())); QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed())); buttonLists[role].append(button); -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) - QAction *action = createSoftKey(button, role); - softKeyActions.insert(button, action); - new QDialogButtonEnabledProxy(action, button, action); -#endif if (doLayout) layoutButtons(); } -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) -QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role) -{ - Q_Q(QDialogButtonBox); - QAction::SoftKeyRole softkeyRole; - - QAction *action = new QAction(button->text(), button); - - switch (role) { - case ApplyRole: - case AcceptRole: - case YesRole: - case ActionRole: - case HelpRole: - softkeyRole = QAction::PositiveSoftKey; - break; - case RejectRole: - case DestructiveRole: - case NoRole: - case ResetRole: - softkeyRole = QAction::NegativeSoftKey; - break; - default: - break; - } - QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked())); - action->setSoftKeyRole(softkeyRole); - - - QWidget *dialog = 0; - QWidget *p = q; - while (p && !p->isWindow()) { - p = p->parentWidget(); - if ((dialog = qobject_cast(p))) - break; - } - - if (dialog) { - dialog->addAction(action); - } else { - q->addAction(action); - } - - return action; -} -#endif - void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardButtons buttons) { uint i = QDialogButtonBox::FirstButton; @@ -724,11 +641,6 @@ void QDialogButtonBoxPrivate::retranslateStrings() if (buttonText) { QPushButton *button = it.key(); button->setText(QDialogButtonBox::tr(buttonText)); -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) - QAction *action = softKeyActions.value(button, 0); - if (action) - action->setText(button->text()); -#endif } ++it; } @@ -921,11 +833,6 @@ void QDialogButtonBox::setOrientation(Qt::Orientation orientation) void QDialogButtonBox::clear() { Q_D(QDialogButtonBox); -#ifdef QT_SOFTKEYS_ENABLED - // Delete softkey actions as they have the buttons as parents - qDeleteAll(d->softKeyActions.values()); - d->softKeyActions.clear(); -#endif // Remove the created standard buttons, they should be in the other lists, which will // do the deletion d->standardButtonHash.clear(); @@ -1003,13 +910,6 @@ void QDialogButtonBox::removeButton(QAbstractButton *button) } } } -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) - QAction *action = d->softKeyActions.value(button, 0); - if (action) { - d->softKeyActions.remove(button); - delete action; - } -#endif if (!d->internalRemove) button->setParent(0); } @@ -1080,11 +980,6 @@ QPushButton *QDialogButtonBox::addButton(StandardButton button) void QDialogButtonBox::setStandardButtons(StandardButtons buttons) { Q_D(QDialogButtonBox); -#ifdef QT_SOFTKEYS_ENABLED - // Delete softkey actions since they have the buttons as parents - qDeleteAll(d->softKeyActions.values()); - d->softKeyActions.clear(); -#endif // Clear out all the old standard buttons, then recreate them. qDeleteAll(d->standardButtonHash.keys()); d->standardButtonHash.clear(); @@ -1242,38 +1137,9 @@ bool QDialogButtonBox::event(QEvent *event) } if (!hasDefault && firstAcceptButton) firstAcceptButton->setDefault(true); -#ifdef QT_SOFTKEYS_ENABLED - if (dialog) - setFixedSize(0,0); -#endif }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); } -#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) - else if (event->type() == QEvent::ParentChange) { - QWidget *dialog = 0; - QWidget *p = this; - while (p && !p->isWindow()) { - p = p->parentWidget(); - if ((dialog = qobject_cast(p))) - break; - } - - // If the parent changes, then move the softkeys - for (QHash::const_iterator it = d->softKeyActions.constBegin(); - it != d->softKeyActions.constEnd(); ++it) { - QAction *current = it.value(); - QList widgets = current->associatedWidgets(); - foreach (QWidget *w, widgets) - w->removeAction(current); - if (dialog) - dialog->addAction(current); - else - addAction(current); - } - } -#endif - return QWidget::event(event); } diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index ffded7839f..fe7e444e86 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -69,7 +69,6 @@ #include "qpushbutton.h" #include #include -#include #include QT_BEGIN_NAMESPACE @@ -158,15 +157,6 @@ void QMenuPrivate::init() QObject::connect(platformMenu, SIGNAL(aboutToShow()), q, SIGNAL(aboutToShow())); QObject::connect(platformMenu, SIGNAL(aboutToHide()), q, SIGNAL(aboutToHide())); } - -#ifdef QT_SOFTKEYS_ENABLED - selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q); - cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q); - selectAction->setPriority(QAction::HighPriority); - cancelAction->setPriority(QAction::HighPriority); - q->addAction(selectAction); - q->addAction(cancelAction); -#endif } int QMenuPrivate::scrollerHeight() const @@ -1674,12 +1664,6 @@ void QMenu::clear() QList acts = actions(); for(int i = 0; i < acts.size(); i++) { -#ifdef QT_SOFTKEYS_ENABLED - Q_D(QMenu); - // Lets not touch to our internal softkey actions - if(acts[i] == d->selectAction || acts[i] == d->cancelAction) - continue; -#endif removeAction(acts[i]); if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty()) delete acts[i]; @@ -2382,13 +2366,6 @@ QMenu::event(QEvent *e) e->accept(); } return true; -#endif -#ifdef QT_SOFTKEYS_ENABLED - case QEvent::LanguageChange: { - d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey)); - d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey)); - } - break; #endif default: break; diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index f6665cba9a..35c665bb25 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -70,10 +70,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp #endif -#ifdef QT_SOFTKEYS_ENABLED -#include -#endif - QT_BEGIN_NAMESPACE class QMenuBarExtension : public QToolButton @@ -719,9 +715,6 @@ void QMenuBarPrivate::init() #endif q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; -#ifdef QT_SOFTKEYS_ENABLED - menuBarAction = 0; -#endif handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -1405,11 +1398,6 @@ void QMenuBar::changeEvent(QEvent *e) || e->type() == QEvent::ApplicationFontChange) { d->itemsDirty = true; d->updateGeometries(); -#ifdef QT_SOFTKEYS_ENABLED - } else if (e->type() == QEvent::LanguageChange) { - if (d->menuBarAction) - d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey)); -#endif } QWidget::changeEvent(e); diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index 4960c60f83..0f08a4e414 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -188,9 +188,6 @@ public: void wceRefresh(); bool wceEmitSignals(QList actions, uint command); #endif -#ifdef QT_SOFTKEYS_ENABLED - QAction *menuBarAction; -#endif }; #endif // QT_NO_MENUBAR -- cgit v1.2.3