diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-10-18 09:07:37 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-10-25 12:12:39 +0200 |
commit | dff3843d98d52e2c32fea07371f91117de0667e9 (patch) | |
tree | 028199eebf8d92722de91412e32352c54cbd5183 /tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | |
parent | 5d5a0842dc87645eab468389198750adc01b0618 (diff) |
QShortcut: Properly port to the new configure system
Move the feature to corelib so that the QMetaType enumeration
values can be properly excluded and there is no need for a
dummy class.
Use QT_REQUIRE_CONFIG in the headers of classes to be disabled.
Add headers/source files in the .pro file depending on the configure
feature in libraries and tests.
Add the necessary exclusions and use QT_CONFIG.
Task-number: QTBUG-76493
Change-Id: I02499ebee1a3d6d9a1e5afd02517beed5f4536b7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp')
-rw-r--r-- | tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f2d4379453..8b372a78cf 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -232,19 +232,25 @@ TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb, bool forceNonNative) { connect(mb, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*))); QMenu *menu = mb->addMenu(QStringLiteral("&accel")); QAction *action = menu->addAction(QStringLiteral("menu1") ); +#if QT_CONFIG(shortcut) action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A)); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); +#endif connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*))); result.menus << menu; result.actions << action; menu = mb->addMenu(QStringLiteral("accel1")); action = menu->addAction(QStringLiteral("&Open...") ); +#if QT_CONFIG(shortcut) action->setShortcut(Qt::Key_O); +#endif result.actions << action; action = menu->addAction(QStringLiteral("action")); +#if QT_CONFIG(shortcut) action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Z)); +#endif result.actions << action; result.menus << menu; @@ -283,7 +289,9 @@ QAction *tst_QMenuBar::createCharacterAction(QMenu *menu, char lowerAscii) QAction *action = menu->addAction(text); action->setObjectName(text); action->setData(QVariant(int(lowerAscii))); +#if QT_CONFIG(shortcut) action->setShortcut(Qt::CTRL + (lowerAscii - 'a' + Qt::Key_A)); +#endif connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered())); return action; } @@ -318,7 +326,9 @@ TestMenu tst_QMenuBar::initComplexMenuBar(QMenuBar *mb) QAction *action = mb->addAction(QStringLiteral("M&enu 3")); action->setData(QVariant(3)); +#if QT_CONFIG(shortcut) action->setShortcut(Qt::ALT + Qt::Key_J); +#endif connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered())); result.actions << action; @@ -1422,7 +1432,9 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() menubar.setNativeMenuBar(false); QMenu menu("menu1"); QAction *first = menubar.addMenu(&menu); +#if QT_CONFIG(shortcut) menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC")); +#endif centerOnScreen(&menubar); menubar.show(); QApplication::setActiveWindow(&menubar); |