summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-11 13:50:30 +0200
committerLars Knoll <lars.knoll@qt.io>2020-09-28 17:23:20 +0200
commit09025084110702a17b1edd7e2e80cd9e063e64fd (patch)
tree980bed89411f5dd79bf5db5d6dea4803261ea8d1 /tests/auto/gui
parent673da7d4607cd5597b3c58f8c118459efdcaaeb3 (diff)
Fix compiler warnings from QKeyCombination
Change lots of code to avoid the deprecated operator+() or implicit casts to int. Change-Id: I0c343cd5b28603afdf1214eefb85e928313345e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp8
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp62
2 files changed, 35 insertions, 35 deletions
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index 382f17d519..28ca3b8e7b 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -353,12 +353,12 @@ void tst_QGuiVariant::toKeySequence_data()
QTest::addColumn<QKeySequence>("result");
- QTest::newRow( "int" ) << QVariant( 67108929 ) << QKeySequence( Qt::CTRL + Qt::Key_A );
+ QTest::newRow( "int" ) << QVariant( 67108929 ) << QKeySequence( Qt::CTRL | Qt::Key_A );
QTest::newRow( "qstring" )
<< QVariant( QString( "Ctrl+A" ) )
- << QKeySequence( Qt::CTRL + Qt::Key_A );
+ << QKeySequence( Qt::CTRL | Qt::Key_A );
}
void tst_QGuiVariant::toKeySequence()
@@ -376,7 +376,7 @@ void tst_QGuiVariant::toString_data()
QTest::addColumn<QVariant>("value");
QTest::addColumn<QString>("result");
- QTest::newRow( "qkeysequence" ) << QVariant::fromValue( QKeySequence( Qt::CTRL + Qt::Key_A ) )
+ QTest::newRow( "qkeysequence" ) << QVariant::fromValue( QKeySequence( Qt::CTRL | Qt::Key_A ) )
#ifndef Q_OS_MAC
<< QString( "Ctrl+A" );
#else
@@ -499,7 +499,7 @@ void tst_QGuiVariant::writeToReadFromDataStream_data()
pixmap.fill( Qt::red );
QTest::newRow( "pixmap_valid" ) << QVariant::fromValue( pixmap ) << false;
QTest::newRow( "image_invalid" ) << QVariant::fromValue( QImage() ) << false;
- QTest::newRow( "keysequence_valid" ) << QVariant::fromValue( QKeySequence( Qt::CTRL + Qt::Key_A ) ) << false;
+ QTest::newRow( "keysequence_valid" ) << QVariant::fromValue( QKeySequence( Qt::CTRL | Qt::Key_A ) ) << false;
QTest::newRow( "palette_valid" ) << QVariant::fromValue(QPalette(QColor("turquoise"))) << false;
QTest::newRow( "pen_valid" ) << QVariant::fromValue( QPen( Qt::red ) ) << false;
QTest::newRow( "pointarray_invalid" ) << QVariant::fromValue( QPolygon() ) << false;
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 107c91507b..c99cfe4f6f 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -178,12 +178,12 @@ void tst_QKeySequence::initTestCase()
void tst_QKeySequence::swap()
{
- QKeySequence ks1(Qt::CTRL+Qt::Key_O);
- QKeySequence ks2(Qt::CTRL+Qt::Key_L);
+ QKeySequence ks1(Qt::CTRL | Qt::Key_O);
+ QKeySequence ks2(Qt::CTRL | Qt::Key_L);
ks1.swap(ks2);
- QCOMPARE(ks1[0], Qt::CTRL+Qt::Key_L);
- QCOMPARE(ks2[0], Qt::CTRL+Qt::Key_O);
+ QCOMPARE(ks1[0], Qt::CTRL | Qt::Key_L);
+ QCOMPARE(ks2[0], Qt::CTRL | Qt::Key_O);
}
void tst_QKeySequence::operatorQString_data()
@@ -549,11 +549,11 @@ void tst_QKeySequence::parseString_data()
// Valid
QTest::newRow("A") << "A" << QKeySequence(Qt::Key_A);
QTest::newRow("a") << "a" << QKeySequence(Qt::Key_A);
- QTest::newRow("Ctrl+Left") << "Ctrl+Left" << QKeySequence(Qt::CTRL + Qt::Key_Left);
- QTest::newRow("CTRL+LEFT") << "CTRL+LEFT" << QKeySequence(Qt::CTRL + Qt::Key_Left);
- QTest::newRow("Meta+A") << "Meta+a" << QKeySequence(Qt::META + Qt::Key_A);
- QTest::newRow("mEtA+A") << "mEtA+a" << QKeySequence(Qt::META + Qt::Key_A);
- QTest::newRow("Ctrl++") << "Ctrl++" << QKeySequence(Qt::CTRL + Qt::Key_Plus);
+ QTest::newRow("Ctrl+Left") << "Ctrl+Left" << QKeySequence(Qt::CTRL | Qt::Key_Left);
+ QTest::newRow("CTRL+LEFT") << "CTRL+LEFT" << QKeySequence(Qt::CTRL | Qt::Key_Left);
+ QTest::newRow("Meta+A") << "Meta+a" << QKeySequence(Qt::META | Qt::Key_A);
+ QTest::newRow("mEtA+A") << "mEtA+a" << QKeySequence(Qt::META | Qt::Key_A);
+ QTest::newRow("Ctrl++") << "Ctrl++" << QKeySequence(Qt::CTRL | Qt::Key_Plus);
// Invalid modifiers
QTest::newRow("Win+A") << "Win+a" << QKeySequence(Qt::Key_unknown);
@@ -630,34 +630,34 @@ void tst_QKeySequence::listToString_data()
QList<QKeySequence> sequences;
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
- << QKeySequence(Qt::META + Qt::Key_A);
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+Left; Meta+A") << "Ctrl+Left; Meta+A" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Semicolon)
- << QKeySequence(Qt::META + Qt::Key_A);
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Semicolon)
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+;; Meta+A") << "Ctrl+;; Meta+A" << sequences;
sequences.clear();
sequences << QKeySequence(Qt::Key_Semicolon)
- << QKeySequence(Qt::META + Qt::Key_A);
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow(";; Meta+A") << ";; Meta+A" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
- << QKeySequence(Qt::META + Qt::Key_Semicolon);
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
+ << QKeySequence(Qt::META | Qt::Key_Semicolon);
QTest::newRow("Ctrl+Left; Meta+;") << "Ctrl+Left; Meta+;" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
<< QKeySequence();
QTest::newRow("Ctrl+Left; ") << "Ctrl+Left; " << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
<< QKeySequence()
- << QKeySequence(Qt::META + Qt::Key_A);
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+Left; ; Meta+A") << "Ctrl+Left; ; Meta+A" << sequences;
}
@@ -676,40 +676,40 @@ void tst_QKeySequence::listFromString_data()
QList<QKeySequence> sequences;
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
- << QKeySequence(Qt::META + Qt::Key_A);
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+Left; Meta+A") << "Ctrl+Left; Meta+A" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Semicolon)
- << QKeySequence(Qt::META + Qt::Key_A);
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Semicolon)
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+;; Meta+A") << "Ctrl+;; Meta+A" << sequences;
sequences.clear();
sequences << QKeySequence(Qt::Key_Semicolon)
- << QKeySequence(Qt::META + Qt::Key_A);
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow(";; Meta+A") << ";; Meta+A" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
- << QKeySequence(Qt::META + Qt::Key_Semicolon);
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
+ << QKeySequence(Qt::META | Qt::Key_Semicolon);
QTest::newRow("Ctrl+Left; Meta+;") << "Ctrl+Left; Meta+;" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
<< QKeySequence();
QTest::newRow("Ctrl+Left; ") << "Ctrl+Left; " << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
<< QKeySequence()
- << QKeySequence(Qt::META + Qt::Key_A);
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+Left; ; Meta+A") << "Ctrl+Left; ; Meta+A" << sequences;
sequences.clear();
- sequences << QKeySequence(Qt::CTRL + Qt::Key_Left)
+ sequences << QKeySequence(Qt::CTRL | Qt::Key_Left)
<< QKeySequence(Qt::Key_unknown)
- << QKeySequence(Qt::META + Qt::Key_A);
+ << QKeySequence(Qt::META | Qt::Key_A);
QTest::newRow("Ctrl+Left; 4+3=2; Meta+A") << "Ctrl+Left; 4+3=2; Meta+A" << sequences;
}