summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-29 13:18:51 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-07-09 18:38:14 +0200
commitc023b025ee7f3e221b1ad947722ec4d4fa5f5e5e (patch)
treea224f06a84b43dde974d91f5f5d0a8365cf123c0
parent89ecbf0978a0e6aeb1eecdeda98339d67c08eb6e (diff)
Qt::Modifier: do some cleanups
Qt::UNICODE_ACCEL had no effect since at least Qt 4.0. We can drop it in Qt 6. The whole Qt::Modifier enumeration is still widely used, so we can't drop it yet, but we should aim at doing so in Qt 7. Add a note. [ChangeLog][QtCore][Qt::Modifier] The Qt::UNICODE_ACCEL enumerator has been removed. It had no effect since Qt 4.0. [ChangeLog][QtCore][Qt::Modifier] Usage of the enumerators in the Qt::Modifier enumeration is discouraged. The enumeration will likely get removed in the next major version of Qt. Change-Id: If25f30d920878d32903b91a38044f5da042c7eab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/corelib/global/qnamespace.h2
-rw-r--r--src/corelib/global/qnamespace.qdoc2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm2
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp28
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp10
5 files changed, 21 insertions, 23 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index cb1c08e4fa..3e2020ebd5 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -96,13 +96,13 @@ namespace Qt {
// user-defined or third-party macros. More so when the identifiers are not
// "namespace"-prefixed. This is considered bad practice and is why
// KeypadModifier was not added to the Modifier enum.
+ // ### Qt 7: consider deprecating in favor of KeyboardModifier.
enum Modifier {
META = Qt::MetaModifier,
SHIFT = Qt::ShiftModifier,
CTRL = Qt::ControlModifier,
ALT = Qt::AltModifier,
MODIFIER_MASK = KeyboardModifierMask,
- UNICODE_ACCEL = 0x00000000
};
enum MouseButton {
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index ad663bc883..1e04cb9573 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -416,8 +416,6 @@
\value META The Meta keys.
\value CTRL The Ctrl keys.
\value ALT The normal Alt keys, but not keys like AltGr.
- \value UNICODE_ACCEL The shortcut is specified as a Unicode code
- point, not as a Qt Key.
\omitvalue MODIFIER_MASK
\sa KeyboardModifier, MouseButton
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index ac245ba5b5..9e6d3b8e88 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -99,7 +99,7 @@ static quint32 constructModifierMask(quint32 accel_key)
// return an autoreleased string given a QKeySequence (currently only looks at the first one).
NSString *keySequenceToKeyEqivalent(const QKeySequence &accel)
{
- quint32 accel_key = (accel[0] & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL));
+ quint32 accel_key = (accel[0] & ~Qt::MODIFIER_MASK);
QChar cocoa_key = QCocoaKeyMapper::toCocoaKey(Qt::Key(accel_key));
if (cocoa_key.isNull())
cocoa_key = QChar(accel_key).toLower().unicode();
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 5a0702951e..c2639fa209 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -196,26 +196,26 @@ void tst_QKeySequence::operatorQString_data()
QTest::addColumn<int>("keycode");
QTest::addColumn<QString>("keystring");
- QTest::newRow( "No modifier" ) << 0 << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString::fromLatin1( "\x0c5" );
+ QTest::newRow( "No modifier" ) << 0 << int(Qt::Key_Aring) << QString::fromLatin1( "\x0c5" );
#ifndef Q_OS_MAC
QTest::newRow( "Ctrl+Left" ) << int(Qt::CTRL) << int(Qt::Key_Left) << QString( "Ctrl+Left" );
QTest::newRow( "Ctrl+," ) << int(Qt::CTRL) << int(Qt::Key_Comma) << QString( "Ctrl+," );
QTest::newRow( "Alt+Left" ) << int(Qt::ALT) << int(Qt::Key_Left) << QString( "Alt+Left" );
QTest::newRow( "Alt+Shift+Left" ) << int(Qt::ALT | Qt::SHIFT) << int(Qt::Key_Left) << QString( "Alt+Shift+Left" );
- QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString::fromLatin1( "Ctrl+\x0c5" );
- QTest::newRow( "Alt" ) << int(Qt::ALT) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString::fromLatin1( "Alt+\x0c5" );
- QTest::newRow( "Shift" ) << int(Qt::SHIFT) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString::fromLatin1( "Shift+\x0c5" );
- QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << QString::fromLatin1( "Meta+\x0c5" );
+ QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring) << QString::fromLatin1( "Ctrl+\x0c5" );
+ QTest::newRow( "Alt" ) << int(Qt::ALT) << int(Qt::Key_Aring) << QString::fromLatin1( "Alt+\x0c5" );
+ QTest::newRow( "Shift" ) << int(Qt::SHIFT) << int(Qt::Key_Aring) << QString::fromLatin1( "Shift+\x0c5" );
+ QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring) << QString::fromLatin1( "Meta+\x0c5" );
#else
QTest::newRow( "Ctrl+Left" ) << int(Qt::CTRL) << int(Qt::Key_Left) << MacCtrl + macSymbolForQtKey(Qt::Key_Left);
QTest::newRow( "Ctrl+," ) << int(Qt::CTRL) << int(Qt::Key_Comma) << MacCtrl + ",";
QTest::newRow( "Alt+Left" ) << int(Qt::ALT) << int(Qt::Key_Left) << MacAlt + macSymbolForQtKey(Qt::Key_Left);
QTest::newRow( "Alt+Shift+Left" ) << int(Qt::ALT | Qt::SHIFT) << int(Qt::Key_Left) << MacAlt + MacShift + macSymbolForQtKey(Qt::Key_Left);
- QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << MacCtrl + QLatin1String("\x0c5");
- QTest::newRow( "Alt" ) << int(Qt::ALT) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << MacAlt + QLatin1String("\x0c5");
- QTest::newRow( "Shift" ) << int(Qt::SHIFT) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << MacShift + QLatin1String("\x0c5");
- QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL) << MacMeta + QLatin1String("\x0c5");
+ QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring) << MacCtrl + QLatin1String("\x0c5");
+ QTest::newRow( "Alt" ) << int(Qt::ALT) << int(Qt::Key_Aring) << MacAlt + QLatin1String("\x0c5");
+ QTest::newRow( "Shift" ) << int(Qt::SHIFT) << int(Qt::Key_Aring) << MacShift + QLatin1String("\x0c5");
+ QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring) << MacMeta + QLatin1String("\x0c5");
#endif
}
@@ -224,11 +224,11 @@ void tst_QKeySequence::symetricConstructors_data()
QTest::addColumn<int>("modifiers");
QTest::addColumn<int>("keycode");
- QTest::newRow( "No modifier" ) << 0 << int(Qt::Key_Aring | Qt::UNICODE_ACCEL);
- QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL);
- QTest::newRow( "Alt" ) << int(Qt::ALT) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL);
- QTest::newRow( "Shift" ) << int(Qt::SHIFT) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL);
- QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring | Qt::UNICODE_ACCEL);
+ QTest::newRow( "No modifier" ) << 0 << int(Qt::Key_Aring);
+ QTest::newRow( "Ctrl" ) << int(Qt::CTRL) << int(Qt::Key_Aring);
+ QTest::newRow( "Alt" ) << int(Qt::ALT) << int(Qt::Key_Aring);
+ QTest::newRow( "Shift" ) << int(Qt::SHIFT) << int(Qt::Key_Aring);
+ QTest::newRow( "Meta" ) << int(Qt::META) << int(Qt::Key_Aring);
}
void tst_QKeySequence::compareConstructors_data()
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index f3d2c300cc..903eab1a3f 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -447,17 +447,17 @@ void tst_QShortcut::number_data()
/* Testing Single Specialkeys
Qt::Key_aring
Qt::Key_Aring
- Qt::UNICODE_ACCEL + Qt::Key_K
+ Qt::Key_K
*/
QTest::newRow("N06 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N07 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N08 - slot2") << SetupAccel << TriggerSlot1 << QString() << int(Qt::UNICODE_ACCEL + Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N08 - slot2") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N:Qt::Key_aring") << TestAccel << NoWidget << QString() << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N:Qt::Key_Aring") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString() << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString() << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:Qt::Qt::Key_K") << TestAccel << NoWidget << QString() << int(Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Multiple Sequences
@@ -592,7 +592,7 @@ void tst_QShortcut::text_data()
/* Testing Single Specialkeys
Qt::Key_aring
Qt::Key_Aring
- Qt::UNICODE_ACCEL + Qt::Key_K
+ Qt::Key_K
*/
/* see comments above on the #ifdef'ery */
QTest::newRow("T06 - slot1") << SetupAccel << TriggerSlot1 << QString::fromLatin1("\x0C5")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
@@ -602,7 +602,7 @@ void tst_QShortcut::text_data()
QTest::newRow("T:Qt::Key_Aring") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString() << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString() << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:Qt::Key_K") << TestAccel << NoWidget << QString() << int(Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Multiple Sequences