diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-01-26 12:54:29 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-01-28 14:02:37 +0200 |
commit | abb18449b0416524f9145e539dcbb922f226ad83 (patch) | |
tree | 9cc2fced1803c468dd96b45c71c4abb3f0f07bdd | |
parent | 440a05cfd1a5e409ed779e6f093c2cebfb94c4de (diff) |
Fix example and tests depreceation warnings
Use QFontDatabase static methods
QVariant type() deprecation
Task-number: QTBUG-89832
Change-Id: Ia5a738d98563a8516770493fdf9e8c130185f1f4
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r-- | examples/widgets/statemachine/rogue/window.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qstatemachine/qstatemachine/tst_qstatemachine.cpp | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/examples/widgets/statemachine/rogue/window.cpp b/examples/widgets/statemachine/rogue/window.cpp index a5363e2..3e7cbf0 100644 --- a/examples/widgets/statemachine/rogue/window.cpp +++ b/examples/widgets/statemachine/rogue/window.cpp @@ -60,15 +60,14 @@ Window::Window() pY = 5; //![0] - QFontDatabase database; QFont font; - if (database.families().contains("Monospace")) { + const QStringList families = QFontDatabase::families(); + if (families.contains("Monospace")) { font = QFont("Monospace"); } else { - const QStringList fontFamilies = database.families(); - for (const QString &family : fontFamilies ) { - if (database.isFixedPitch(family)) { + for (const QString &family : families) { + if (QFontDatabase::isFixedPitch(family)) { font = QFont(family); break; } diff --git a/tests/auto/qstatemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/qstatemachine/tst_qstatemachine.cpp index 486d44f..3fb34bd 100644 --- a/tests/auto/qstatemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/qstatemachine/tst_qstatemachine.cpp @@ -65,7 +65,7 @@ static int globalTick; { \ QTRY_COMPARE(runningSpy.count(), 1); \ QList<QVariant> runningArgs = runningSpy.takeFirst(); \ - QVERIFY(runningArgs.at(0).type() == QVariant::Bool); \ + QVERIFY(runningArgs.at(0).typeId() == QMetaType::Bool); \ QVERIFY(runningArgs.at(0).toBool() == RUNNING); \ QCOMPARE(machine.isRunning(), runningArgs.at(0).toBool()); \ } @@ -74,10 +74,10 @@ static int globalTick; { \ QTRY_COMPARE(runningSpy.count(), 2); \ QList<QVariant> runningArgs = runningSpy.takeFirst(); \ - QVERIFY(runningArgs.at(0).type() == QVariant::Bool); \ + QVERIFY(runningArgs.at(0).typeId() == QMetaType::Bool); \ QVERIFY(runningArgs.at(0).toBool() == true); \ runningArgs = runningSpy.takeFirst(); \ - QVERIFY(runningArgs.at(0).type() == QVariant::Bool); \ + QVERIFY(runningArgs.at(0).typeId() == QMetaType::Bool); \ QVERIFY(runningArgs.at(0).toBool() == false); \ QCOMPARE(machine.isRunning(), runningArgs.at(0).toBool()); \ } @@ -91,7 +91,7 @@ static int globalTick; QTRY_COMPARE(VAR##_activeSpy.count(), COUNT); \ bool active = true; \ for (const QList<QVariant> &activeArgs : static_cast<QList<QList<QVariant> > >(VAR##_activeSpy)) { \ - QVERIFY(activeArgs.at(0).type() == QVariant::Bool); \ + QVERIFY(activeArgs.at(0).typeId() == QMetaType::Bool); \ QVERIFY(activeArgs.at(0).toBool() == active); \ active = !active; \ } \ |