From a2feb993aea9ab39d823daaa5d983546f0dd758d Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Thu, 16 Jan 2020 17:09:05 +0100 Subject: Fix deprecation warnings Suggested changes: * endl -> Qt::endl * {} for default QFlags * QString -> QStringLiteral for QStringList::join * QNetworkReply::error -> networkError Change-Id: I03919ab0675a9beb64bd176e6c681a338b08b51e Reviewed-by: Friedemann Kleint --- src/tools/qwebengine_convert_dict/main.cpp | 32 +++++++++++----------- src/webengine/api/qquickwebenginetestsupport.cpp | 2 +- src/webenginewidgets/api/qwebenginepage.cpp | 4 +-- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/tools/qwebengine_convert_dict/main.cpp b/src/tools/qwebengine_convert_dict/main.cpp index 1694dbcef..0ebba96b1 100644 --- a/src/tools/qwebengine_convert_dict/main.cpp +++ b/src/tools/qwebengine_convert_dict/main.cpp @@ -84,7 +84,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, hunspell::BDictReader reader; if (!reader.Init(reinterpret_cast(serialized.data()), serialized.size())) { - out << "BDict is invalid" << endl; + out << "BDict is invalid" << Qt::endl; return false; } hunspell::WordIterator iter = reader.GetAllWordIterator(); @@ -96,7 +96,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, for (size_t i = 0; i < org_words.size(); i++) { int affix_matches = iter.Advance(buf, buf_size, affix_ids); if (affix_matches == 0) { - out << "Found the end before we expected" << endl; + out << "Found the end before we expected" << Qt::endl; return false; } @@ -104,7 +104,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, out << "Word does not match!\n" << " Index: " << i << "\n" << " Expected: " << QString::fromStdString(org_words[i].first) << "\n" - << " Actual: " << QString::fromUtf8(buf) << endl; + << " Actual: " << QString::fromUtf8(buf) << Qt::endl; return false; } @@ -118,7 +118,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, << " Index: " << i << "\n" << " Word: " << QString::fromUtf8(buf) << "\n" << " Expected: " << expectedAffixes << "\n" - << " Actual: " << actualAffixes << endl; + << " Actual: " << actualAffixes << Qt::endl; return false; } } @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) out << "Usage: qwebengine_convert_dict \n\nExample:\n" "qwebengine_convert_dict ./en-US.dic ./en-US.bdic\nwill read en-US.dic, " "en-US.dic_delta, and en-US.aff from the current directory and generate " - "en-US.bdic\n" << endl; + "en-US.bdic\n" << Qt::endl; return 1; } @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) out << "Couldn't find ICU data directory. Please check that the following path exists: " << icuDataDir << "\nAlternatively provide the directory path via the QT_WEBENGINE_ICU_DAT_DIR " - "environment variable.\n" << endl; + "environment variable.\n" << Qt::endl; return 1; } @@ -196,21 +196,21 @@ int main(int argc, char *argv[]) base::FilePath file_out_path = toFilePath(argv[2]); base::FilePath aff_path = file_in_path.ReplaceExtension(FILE_PATH_LITERAL(".aff")); - out << "Reading " << toQt(aff_path.value()) << endl; + out << "Reading " << toQt(aff_path.value()) << Qt::endl; convert_dict::AffReader aff_reader(aff_path); if (!aff_reader.Read()) { - out << "Unable to read the aff file." << endl; + out << "Unable to read the aff file." << Qt::endl; return 1; } base::FilePath dic_path = file_in_path.ReplaceExtension(FILE_PATH_LITERAL(".dic")); - out << "Reading " << toQt(dic_path.value()) << endl; + out << "Reading " << toQt(dic_path.value()) << Qt::endl; // DicReader will also read the .dic_delta file. convert_dict::DicReader dic_reader(dic_path); if (!dic_reader.Read(&aff_reader)) { - out << "Unable to read the dic file." << endl; + out << "Unable to read the dic file." << Qt::endl; return 1; } @@ -222,27 +222,27 @@ int main(int argc, char *argv[]) writer.SetOtherCommands(aff_reader.other_commands()); writer.SetWords(dic_reader.words()); - out << "Serializing..." << endl; + out << "Serializing..." << Qt::endl; std::string serialized = writer.GetBDict(); - out << "Verifying..." << endl; + out << "Verifying..." << Qt::endl; if (!VerifyWords(dic_reader.words(), serialized, out)) { - out << "ERROR converting, the dictionary does not check out OK." << endl; + out << "ERROR converting, the dictionary does not check out OK." << Qt::endl; return 1; } - out << "Writing " << toQt(file_out_path.value()) << endl; + out << "Writing " << toQt(file_out_path.value()) << Qt::endl; FILE *out_file = base::OpenFile(file_out_path, "wb"); if (!out_file) { - out << "ERROR writing file" << endl; + out << "ERROR writing file" << Qt::endl; return 1; } size_t written = fwrite(&serialized[0], 1, serialized.size(), out_file); Q_ASSERT(written == serialized.size()); base::CloseFile(out_file); - out << "Success. Dictionary converted." << endl; + out << "Success. Dictionary converted." << Qt::endl; return 0; } diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp index b7b863125..bef87160e 100644 --- a/src/webengine/api/qquickwebenginetestsupport.cpp +++ b/src/webengine/api/qquickwebenginetestsupport.cpp @@ -157,7 +157,7 @@ void QQuickWebEngineTestEvent::mouseEvent(QEvent::Type type, QWindow *window, QO if (sgitem) pos = sgitem->mapToScene(_pos).toPoint(); - QMouseEvent me(type, pos, window->mapFromGlobal(pos), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent me(type, pos, window->mapFromGlobal(pos), Qt::LeftButton, Qt::LeftButton, {}); me.setTimestamp(++QTest::lastMouseTimestamp); QSpontaneKeyEvent::setSpontaneous(&me); diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 33a7721e7..c176589b2 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2313,7 +2313,7 @@ QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringLis QString str; switch (static_cast(mode)) { case FilePickerController::OpenMultiple: - ret = QFileDialog::getOpenFileNames(view(), QString(), QString(), filter.join(";;"), nullptr, QFileDialog::HideNameFilterDetails); + ret = QFileDialog::getOpenFileNames(view(), QString(), QString(), filter.join(QStringLiteral(";;")), nullptr, QFileDialog::HideNameFilterDetails); break; // Chromium extension, not exposed as part of the public API for now. case FilePickerController::UploadFolder: @@ -2327,7 +2327,7 @@ QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringLis ret << str; break; case FilePickerController::Open: - str = QFileDialog::getOpenFileName(view(), QString(), oldFiles.first(), filter.join(";;"), nullptr, QFileDialog::HideNameFilterDetails); + str = QFileDialog::getOpenFileName(view(), QString(), oldFiles.first(), filter.join(QStringLiteral(";;")), nullptr, QFileDialog::HideNameFilterDetails); if (!str.isNull()) ret << str; break; diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 2ed4e10c3..3819080e2 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1975,7 +1975,7 @@ private Q_SLOTS: void continueError() { - emit error(this->error()); + emit error(this->networkError()); emit finished(); } }; -- cgit v1.2.3