From 3b8f828174f08d9037a0947b8709648ac37cdc36 Mon Sep 17 00:00:00 2001 From: Maciej Czarnecki Date: Mon, 21 Aug 2017 13:28:51 +0200 Subject: QWizard: Do not remove the Next button's shortcut Currently on Windows, the Next button's shortcut doesn't work, because QWizard overrides it with an empty key sequence. The key sequence should be changed only if isVistaThemeEnabled() returns true. Task-number: QTBUG-46894 Change-Id: I54f26388b167973cc8065a867d9e771c1e6a2a72 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/auto/widgets/dialogs') diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index db86fba59c..6ad93b2666 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -96,6 +96,7 @@ private slots: void task248107_backButton(); void task255350_fieldObjectDestroyed(); void taskQTBUG_25691_fieldObjectDestroyed2(); + void taskQTBUG_46894_nextButtonShortcut(); /* Things that could be added: @@ -2700,5 +2701,24 @@ void tst_QWizard::taskQTBUG_25691_fieldObjectDestroyed2() ::taskQTBUG_25691_fieldObjectDestroyed2(); } +void tst_QWizard::taskQTBUG_46894_nextButtonShortcut() +{ + for (int i = 0; i < QWizard::NStyles; ++i) { + QWizard wizard; + QWizard::WizardStyle style = static_cast(i); + wizard.setWizardStyle(style); + wizard.show(); + QVERIFY(QTest::qWaitForWindowExposed(&wizard)); + + if (wizard.button(QWizard::NextButton)->text() == "&Next") { + QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(), + QKeySequence(Qt::ALT | Qt::Key_Right)); + } else { + QCOMPARE(wizard.button(QWizard::NextButton)->shortcut(), + QKeySequence::mnemonic(wizard.button(QWizard::NextButton)->text())); + } + } +} + QTEST_MAIN(tst_QWizard) #include "tst_qwizard.moc" -- cgit v1.2.3 From 19b0ce5daa31e2ffebfcf2701143742302f1deb4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 13 Apr 2017 21:13:52 -0700 Subject: Change almost all other uses of qrand() to QRandomGenerator The vast majority is actually switched to QRandomGenerator::bounded(), which gives a mostly uniform distribution over the [0, bound) range. There are very few floating point cases left, as many of those that did use floating point did not need to, after all. (I did leave some that were too ugly for me to understand) This commit also found a couple of calls to rand() instead of qrand(). This commit does not include changes to SSL code that continues to use qrand() (job for someone else): src/network/ssl/qsslkey_qt.cpp src/network/ssl/qsslsocket_mac.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll --- tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/widgets/dialogs') diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 09e070ac20..eafd4d7cea 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include "../../../../../src/widgets/dialogs/qsidebar_p.h" #include "../../../../../src/widgets/dialogs/qfilesystemmodel_p.h" #include "../../../../../src/widgets/dialogs/qfiledialog_p.h" @@ -1196,7 +1197,7 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly() { const QString tempPath = tempDir.path(); QDir dirTemp(tempPath); - const QString tempName = QLatin1String("showDirsOnly.") + QString::number(qrand()); + const QString tempName = QLatin1String("showDirsOnly.") + QString::number(QRandomGenerator::global()->generate()); dirTemp.mkdir(tempName); dirTemp.cd(tempName); QTRY_VERIFY(dirTemp.exists()); -- cgit v1.2.3