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 --- .../kernel/qactiongroup/tst_qactiongroup.cpp | 14 ++----- .../qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 48 ---------------------- .../widgets/qmainwindow/tst_qmainwindow.cpp | 34 ++++++--------- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 17 +------- 4 files changed, 18 insertions(+), 95 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp index bd4e53e7ed..7d724514b9 100644 --- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp +++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp @@ -171,14 +171,6 @@ void tst_QActionGroup::separators() mw.show(); -#ifdef QT_SOFTKEYS_ENABLED - // Softkeys add extra "Select" and "Back" actions to menu by default. - // Two first actions will be Select and Back when softkeys are enabled - int numSoftkeyActions = 2; -#else - int numSoftkeyActions = 0; -#endif - QAction *action = new QAction(&actGroup); action->setText("test one"); @@ -190,13 +182,13 @@ void tst_QActionGroup::separators() while (it.hasNext()) menu.addAction(it.next()); - QCOMPARE((int)menu.actions().size(), 2 + numSoftkeyActions); + QCOMPARE((int)menu.actions().size(), 2); it = QListIterator(actGroup.actions()); while (it.hasNext()) menu.removeAction(it.next()); - QCOMPARE((int)menu.actions().size(), 0 + numSoftkeyActions); + QCOMPARE((int)menu.actions().size(), 0); action = new QAction(&actGroup); action->setText("test two"); @@ -205,7 +197,7 @@ void tst_QActionGroup::separators() while (it.hasNext()) menu.addAction(it.next()); - QCOMPARE((int)menu.actions().size(), 3 + numSoftkeyActions); + QCOMPARE((int)menu.actions().size(), 3); } void tst_QActionGroup::testActionInTwoQActionGroup() diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 8c8f5b5d71..74b30039f8 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -107,9 +107,6 @@ private slots: void testSignalOrder(); void testDefaultButton_data(); void testDefaultButton(); -#ifdef QT_SOFTKEYS_ENABLED - void testSoftKeyReparenting(); -#endif void task191642_default(); private: @@ -714,51 +711,6 @@ void tst_QDialogButtonBox::testDefaultButton_data() QTest::newRow("third accept explicit after add") << 0 << 2 << 2; } -static int softKeyCount(QWidget *widget) -{ - int softkeyCount = 0; -#ifndef QT_NO_ACTION - QList actions = widget->actions(); - foreach (QAction *action, actions) { - if (action->softKeyRole() != QAction::NoSoftKey) - softkeyCount++; - } -#endif - return softkeyCount; -} - -#ifdef QT_SOFTKEYS_ENABLED -void tst_QDialogButtonBox::testSoftKeyReparenting() -{ - QDialog dialog; - QDialogButtonBox *buttonBox = new QDialogButtonBox; - buttonBox->addButton(QDialogButtonBox::Ok); - buttonBox->addButton(QDialogButtonBox::Cancel); - -#ifndef QT_NO_ACTION - QCOMPARE(softKeyCount(&dialog), 0); - QCOMPARE(softKeyCount(buttonBox), 2); -#endif - - // Were the softkeys re-parented correctly? - dialog.setLayout(new QVBoxLayout); - dialog.layout()->addWidget(buttonBox); -#ifndef QT_NO_ACTION - QCOMPARE(softKeyCount(&dialog), 2); - QCOMPARE(softKeyCount(buttonBox), 0); -#endif - - // Softkeys are only added to QDialog, not QWidget - QWidget *nested = new QWidget; - nested->setLayout(new QVBoxLayout); - nested->layout()->addWidget(buttonBox); -#ifndef QT_NO_ACTION - QCOMPARE(softKeyCount(nested), 0); - QCOMPARE(softKeyCount(buttonBox), 2); -#endif -} -#endif - void tst_QDialogButtonBox::testDefaultButton() { QFETCH(int, whenToSetDefault); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index cf2d0de0e2..5f0a1e84b0 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1322,26 +1322,18 @@ void tst_QMainWindow::createPopupMenu() mainwindow.addDockWidget(Qt::LeftDockWidgetArea, &dockwidget4); -#ifdef QT_SOFTKEYS_ENABLED - // Softkeys add extra "Select" and "Back" actions to menu by default. - // Two first actions will be Select and Back when softkeys are enabled - int numSoftkeyActions = 2; -#else - int numSoftkeyActions = 0; -#endif - QMenu *menu = mainwindow.createPopupMenu(); QVERIFY(menu != 0); QList actions = menu->actions(); - QCOMPARE(actions.size(), 7 + numSoftkeyActions); + QCOMPARE(actions.size(), 7); - QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget1.toggleViewAction()); - QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget2.toggleViewAction()); - QCOMPARE(actions.at(2 + numSoftkeyActions), dockwidget3.toggleViewAction()); - QCOMPARE(actions.at(3 + numSoftkeyActions), dockwidget4.toggleViewAction()); - QVERIFY(actions.at(4 + numSoftkeyActions)->isSeparator()); - QCOMPARE(actions.at(5 + numSoftkeyActions), toolbar1.toggleViewAction()); - QCOMPARE(actions.at(6 + numSoftkeyActions), toolbar2.toggleViewAction()); + QCOMPARE(actions.at(0), dockwidget1.toggleViewAction()); + QCOMPARE(actions.at(1), dockwidget2.toggleViewAction()); + QCOMPARE(actions.at(2), dockwidget3.toggleViewAction()); + QCOMPARE(actions.at(3), dockwidget4.toggleViewAction()); + QVERIFY(actions.at(4)->isSeparator()); + QCOMPARE(actions.at(5), toolbar1.toggleViewAction()); + QCOMPARE(actions.at(6), toolbar2.toggleViewAction()); delete menu; @@ -1352,12 +1344,12 @@ void tst_QMainWindow::createPopupMenu() menu = mainwindow.createPopupMenu(); QVERIFY(menu != 0); actions = menu->actions(); - QCOMPARE(actions.size(), 4 + numSoftkeyActions); + QCOMPARE(actions.size(), 4); - QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget2.toggleViewAction()); - QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget3.toggleViewAction()); - QVERIFY(actions.at(2 + numSoftkeyActions)->isSeparator()); - QCOMPARE(actions.at(3 + numSoftkeyActions), toolbar2.toggleViewAction()); + QCOMPARE(actions.at(0), dockwidget2.toggleViewAction()); + QCOMPARE(actions.at(1), dockwidget3.toggleViewAction()); + QVERIFY(actions.at(2)->isSeparator()); + QCOMPARE(actions.at(3), toolbar2.toggleViewAction()); delete menu; } diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 4a53473903..28068a808d 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -243,17 +243,9 @@ void tst_QMenu::onStatusMessageChanged(const QString &s) void tst_QMenu::addActionsAndClear() { -#ifdef QT_SOFTKEYS_ENABLED - // Softkeys add extra "Select" and "Back" actions to menu by default. - // Two first actions will be Select and Back when softkeys are enabled - int numSoftkeyActions = 2; -#else - int numSoftkeyActions = 0; -#endif - - QCOMPARE(menus[0]->actions().count(), 0 + numSoftkeyActions); + QCOMPARE(menus[0]->actions().count(), 0); createActions(); - QCOMPARE(menus[0]->actions().count(), 8 + numSoftkeyActions); + QCOMPARE(menus[0]->actions().count(), 8); menus[0]->clear(); QCOMPARE(menus[0]->actions().count(), 0); } @@ -730,11 +722,6 @@ void tst_QMenu::menuSizeHint() int maxWidth =0; QRect result; foreach (QAction *action, menu.actions()) { -#ifdef QT_SOFTKEYS_ENABLED - // Softkey actions are not widgets and have no geometry. - if (menu.actionGeometry(action).topLeft() == QPoint(0,0)) - continue; -#endif maxWidth = qMax(maxWidth, menu.actionGeometry(action).width()); result |= menu.actionGeometry(action); QCOMPARE(result.x(), left + hmargin + panelWidth); -- cgit v1.2.3