diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-06-08 16:28:58 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-10 23:20:07 +0000 |
commit | ee3e1886d6154a3faaf7536986e8c70ec4f3c373 (patch) | |
tree | 0603c3e229f865001cdd4678a2c8812aa1cbd21c | |
parent | d627842e98c1cbaec0123566dc1af7b6018e5dc1 (diff) |
Fix some compiler warnings
- Remove deprecated Qt::AA_EnableHighDpiScaling and Qt::AA_UseHighDpiPixmaps
from examples. High-DPI scaling is always enabled.
- Reorder initialization of members of QWebEngineDownloadRequestPrivate.
Also remove m_ prefix from public members' name.
- Remove unused parameters from methods of DummyDelegate.
- Add missing overrides in auto tests.
Change-Id: I18d6973b8bee574b37b73fbaaa8d57002ac8ba2d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 740b8c94f27930a33298c81c2284d1f0a9e2f11b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
34 files changed, 53 insertions, 92 deletions
diff --git a/examples/pdf/multipage/main.cpp b/examples/pdf/multipage/main.cpp index 446b2999b..9311afa8e 100644 --- a/examples/pdf/multipage/main.cpp +++ b/examples/pdf/multipage/main.cpp @@ -56,7 +56,6 @@ int main(int argc, char* argv[]) QCoreApplication::setApplicationName("Qt Quick Multi-page PDF Viewer Example"); QCoreApplication::setOrganizationName("QtProject"); QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; diff --git a/examples/pdf/pdfviewer/main.cpp b/examples/pdf/pdfviewer/main.cpp index 13db2b88a..b9f1e22de 100644 --- a/examples/pdf/pdfviewer/main.cpp +++ b/examples/pdf/pdfviewer/main.cpp @@ -56,7 +56,6 @@ int main(int argc, char* argv[]) QCoreApplication::setApplicationName("Qt Quick PDF Viewer Example"); QCoreApplication::setOrganizationName("QtProject"); QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; diff --git a/examples/webengine/customdialogs/main.cpp b/examples/webengine/customdialogs/main.cpp index 5aad8affb..e3c4ad085 100644 --- a/examples/webengine/customdialogs/main.cpp +++ b/examples/webengine/customdialogs/main.cpp @@ -66,7 +66,6 @@ typedef QGuiApplication Application; int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QtWebEngine::initialize(); Application app(argc, argv); diff --git a/examples/webengine/lifecycle/main.cpp b/examples/webengine/lifecycle/main.cpp index bb93d64a7..3972639c5 100644 --- a/examples/webengine/lifecycle/main.cpp +++ b/examples/webengine/lifecycle/main.cpp @@ -57,7 +57,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QtWebEngine::initialize(); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; diff --git a/examples/webengine/minimal/doc/src/minimal.qdoc b/examples/webengine/minimal/doc/src/minimal.qdoc index 4fc62bddb..1e629f689 100644 --- a/examples/webengine/minimal/doc/src/minimal.qdoc +++ b/examples/webengine/minimal/doc/src/minimal.qdoc @@ -56,10 +56,6 @@ \l{WebEngineProfile::cachePath} and \l{WebEngineProfile::persistentStoragePath}). - We also set the Qt::AA_EnableHighDpiScaling attribute. This lets the web - view automatically scale on high-dpi displays. Then we instantiate a - QGuiApplication object. - Next, we call \l{QtWebEngine::initialize}, which makes sure that OpenGL contexts can be shared between the main process and the dedicated renderer process (\c QtWebEngineProcess). This method needs to be called before diff --git a/examples/webengine/minimal/main.cpp b/examples/webengine/minimal/main.cpp index 86109f97a..fde716451 100644 --- a/examples/webengine/minimal/main.cpp +++ b/examples/webengine/minimal/main.cpp @@ -55,7 +55,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QtWebEngine::initialize(); QGuiApplication app(argc, argv); diff --git a/examples/webengine/quicknanobrowser/main.cpp b/examples/webengine/quicknanobrowser/main.cpp index f804c0d14..4c4c80390 100644 --- a/examples/webengine/quicknanobrowser/main.cpp +++ b/examples/webengine/quicknanobrowser/main.cpp @@ -79,7 +79,6 @@ static QUrl startupUrl() int main(int argc, char **argv) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QtWebEngine::initialize(); Application app(argc, argv); diff --git a/examples/webengine/recipebrowser/doc/src/recipebrowser.qdoc b/examples/webengine/recipebrowser/doc/src/recipebrowser.qdoc index 63a0af361..6e1ed84e3 100644 --- a/examples/webengine/recipebrowser/doc/src/recipebrowser.qdoc +++ b/examples/webengine/recipebrowser/doc/src/recipebrowser.qdoc @@ -47,8 +47,7 @@ In \c main.cpp, we use the \l{QGuiApplication} and \l{QQmlApplicationEngine} classes to set up and load the main QML file. We call \l{QtWebEngine::initialize} so we can use - \l{WebEngineView} in our QML code. We enable high DPI screen support by setting the - \l{Qt::AA_EnableHighDpiScaling} attribute. We set the default Qt Quick Controls 2 style + \l{WebEngineView} in our QML code. We set the default Qt Quick Controls 2 style to the Material style, so we do not have to specify it for each new item we add. Finally, we use a C++ define to check whether the application is compiled for an embedded platform. The value will be used in the main QML code to determine the window size. diff --git a/examples/webengine/recipebrowser/main.cpp b/examples/webengine/recipebrowser/main.cpp index e61b9e0f5..b5e5224ed 100644 --- a/examples/webengine/recipebrowser/main.cpp +++ b/examples/webengine/recipebrowser/main.cpp @@ -57,7 +57,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QtWebEngine::initialize(); QGuiApplication app(argc, argv); diff --git a/examples/webengine/webengineaction/main.cpp b/examples/webengine/webengineaction/main.cpp index f2dec9655..b0ef0848a 100644 --- a/examples/webengine/webengineaction/main.cpp +++ b/examples/webengine/webengineaction/main.cpp @@ -55,7 +55,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QtWebEngine::initialize(); QGuiApplication app(argc, argv); diff --git a/examples/webenginewidgets/contentmanipulation/main.cpp b/examples/webenginewidgets/contentmanipulation/main.cpp index 417b87184..b53fdef47 100644 --- a/examples/webenginewidgets/contentmanipulation/main.cpp +++ b/examples/webenginewidgets/contentmanipulation/main.cpp @@ -55,7 +55,6 @@ int main(int argc, char * argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QUrl url; diff --git a/examples/webenginewidgets/cookiebrowser/main.cpp b/examples/webenginewidgets/cookiebrowser/main.cpp index 2a7fe6362..b3fe71840 100644 --- a/examples/webenginewidgets/cookiebrowser/main.cpp +++ b/examples/webenginewidgets/cookiebrowser/main.cpp @@ -55,7 +55,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); MainWindow window(QUrl("http://qt.io")); window.resize(1024, 768); diff --git a/examples/webenginewidgets/maps/main.cpp b/examples/webenginewidgets/maps/main.cpp index cfcfa06d8..4a0fedb7b 100644 --- a/examples/webenginewidgets/maps/main.cpp +++ b/examples/webenginewidgets/maps/main.cpp @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); MainWindow mainWindow; diff --git a/examples/webenginewidgets/markdowneditor/main.cpp b/examples/webenginewidgets/markdowneditor/main.cpp index b7a7905be..059e9e64c 100644 --- a/examples/webenginewidgets/markdowneditor/main.cpp +++ b/examples/webenginewidgets/markdowneditor/main.cpp @@ -57,7 +57,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication a(argc, argv); MainWindow window; diff --git a/examples/webenginewidgets/minimal/doc/src/minimal.qdoc b/examples/webenginewidgets/minimal/doc/src/minimal.qdoc index b04390d23..9a0ee4593 100644 --- a/examples/webenginewidgets/minimal/doc/src/minimal.qdoc +++ b/examples/webenginewidgets/minimal/doc/src/minimal.qdoc @@ -57,9 +57,6 @@ \l{QWebEngineProfile::cachePath} and \l{QWebEngineProfile::persistentStoragePath}). - We also set the Qt::AA_EnableHighDpiScaling attribute. This lets the web - view automatically scale on high-dpi displays. - Next, we instantiate a QApplication and a QWebEngineView. The URL to load is taken from \c commandLineUrlArgument and loaded by calling \l QWebEngineView::setUrl. The view widget is diff --git a/examples/webenginewidgets/minimal/main.cpp b/examples/webenginewidgets/minimal/main.cpp index b31382ad5..a2c5e4873 100644 --- a/examples/webenginewidgets/minimal/main.cpp +++ b/examples/webenginewidgets/minimal/main.cpp @@ -64,7 +64,6 @@ QUrl commandLineUrlArgument() int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QWebEngineView view; diff --git a/examples/webenginewidgets/notifications/main.cpp b/examples/webenginewidgets/notifications/main.cpp index c3039b9e0..9a797376c 100644 --- a/examples/webenginewidgets/notifications/main.cpp +++ b/examples/webenginewidgets/notifications/main.cpp @@ -72,7 +72,6 @@ public: int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setOrganizationName("QtExamples"); QApplication app(argc, argv); diff --git a/examples/webenginewidgets/printme/main.cpp b/examples/webenginewidgets/printme/main.cpp index 3993c6740..588026eb2 100644 --- a/examples/webenginewidgets/printme/main.cpp +++ b/examples/webenginewidgets/printme/main.cpp @@ -55,7 +55,6 @@ int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QWebEngineView view; diff --git a/examples/webenginewidgets/simplebrowser/main.cpp b/examples/webenginewidgets/simplebrowser/main.cpp index 543742b33..19aae839c 100644 --- a/examples/webenginewidgets/simplebrowser/main.cpp +++ b/examples/webenginewidgets/simplebrowser/main.cpp @@ -68,8 +68,6 @@ QUrl commandLineUrlArgument() int main(int argc, char **argv) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication app(argc, argv); app.setWindowIcon(QIcon(QStringLiteral(":AppLogoColor.png"))); diff --git a/examples/webenginewidgets/spellchecker/main.cpp b/examples/webenginewidgets/spellchecker/main.cpp index bf056ea9e..c2951fe00 100644 --- a/examples/webenginewidgets/spellchecker/main.cpp +++ b/examples/webenginewidgets/spellchecker/main.cpp @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); WebView view; diff --git a/examples/webenginewidgets/stylesheetbrowser/main.cpp b/examples/webenginewidgets/stylesheetbrowser/main.cpp index 9cd294d48..571fccb11 100644 --- a/examples/webenginewidgets/stylesheetbrowser/main.cpp +++ b/examples/webenginewidgets/stylesheetbrowser/main.cpp @@ -58,7 +58,6 @@ int main(int argc, char *argv[]) qRegisterMetaType<StyleSheet>("StyleSheet"); QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication a(argc, argv); MainWindow w(QUrl("http://qt.io")); w.show(); diff --git a/examples/webenginewidgets/videoplayer/main.cpp b/examples/webenginewidgets/videoplayer/main.cpp index cfcfa06d8..4a0fedb7b 100644 --- a/examples/webenginewidgets/videoplayer/main.cpp +++ b/examples/webenginewidgets/videoplayer/main.cpp @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); MainWindow mainWindow; diff --git a/examples/webenginewidgets/webui/main.cpp b/examples/webenginewidgets/webui/main.cpp index 0f6a3e87e..92c1b8e7d 100644 --- a/examples/webenginewidgets/webui/main.cpp +++ b/examples/webenginewidgets/webui/main.cpp @@ -58,7 +58,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); WebUiHandler::registerUrlScheme(); diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index eae48b017..006fd2e4b 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -158,8 +158,7 @@ static inline QWebEngineDownloadRequest::DownloadInterruptReason toDownloadInter */ QWebEngineDownloadRequestPrivate::QWebEngineDownloadRequestPrivate(QtWebEngineCore::ProfileAdapter *adapter, const QUrl &url) - : m_profileAdapter(adapter) - , downloadFinished(false) + : downloadFinished(false) , downloadId(-1) , downloadState(QWebEngineDownloadRequest::DownloadCancelled) , savePageFormat(QWebEngineDownloadRequest::MimeHtmlSaveFormat) @@ -170,7 +169,8 @@ QWebEngineDownloadRequestPrivate::QWebEngineDownloadRequestPrivate(QtWebEngineCo , totalBytes(-1) , receivedBytes(0) , isSavePageDownload(false) - , m_adapterClient(nullptr) + , profileAdapter(adapter) + , adapterClient(nullptr) { } @@ -272,8 +272,8 @@ void QWebEngineDownloadRequest::cancel() // We directly cancel the download request if the user cancels // before it even started, so no need to notify the profile here. if (state == QWebEngineDownloadRequest::DownloadInProgress) { - if (d->m_profileAdapter) - d->m_profileAdapter->cancelDownload(d->downloadId); + if (d->profileAdapter) + d->profileAdapter->cancelDownload(d->downloadId); } else { d->downloadState = QWebEngineDownloadRequest::DownloadCancelled; Q_EMIT stateChanged(d->downloadState); @@ -299,8 +299,8 @@ void QWebEngineDownloadRequest::pause() if (state != QWebEngineDownloadRequest::DownloadInProgress) return; - if (d->m_profileAdapter) - d->m_profileAdapter->pauseDownload(d->downloadId); + if (d->profileAdapter) + d->profileAdapter->pauseDownload(d->downloadId); } /*! @@ -319,8 +319,8 @@ void QWebEngineDownloadRequest::resume() if (d->downloadFinished || (state != QWebEngineDownloadRequest::DownloadInProgress && state != QWebEngineDownloadRequest::DownloadInterrupted)) return; - if (d->m_profileAdapter) - d->m_profileAdapter->resumeDownload(d->downloadId); + if (d->profileAdapter) + d->profileAdapter->resumeDownload(d->downloadId); } /*! @@ -521,10 +521,10 @@ void QWebEngineDownloadRequest::setDownloadDirectory(const QString &directory) Q_EMIT downloadDirectoryChanged(); } - if (!d->isCustomFileName && d->m_profileAdapter) { - QString newFileName = QFileInfo(d->m_profileAdapter->determineDownloadPath(d->downloadDirectory, - d->suggestedFileName, - d->startTime)).fileName(); + if (!d->isCustomFileName && d->profileAdapter) { + QString newFileName = QFileInfo(d->profileAdapter->determineDownloadPath(d->downloadDirectory, + d->suggestedFileName, + d->startTime)).fileName(); if (d->downloadFileName != newFileName) { d->downloadFileName = newFileName; Q_EMIT downloadFileNameChanged(); diff --git a/src/core/api/qwebenginedownloadrequest_p.h b/src/core/api/qwebenginedownloadrequest_p.h index db2e70852..49980dbb8 100644 --- a/src/core/api/qwebenginedownloadrequest_p.h +++ b/src/core/api/qwebenginedownloadrequest_p.h @@ -90,8 +90,8 @@ public: qint64 receivedBytes; bool isSavePageDownload; QWebEngineDownloadRequest *q_ptr; - QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; - QtWebEngineCore::WebContentsAdapterClient *m_adapterClient; + QPointer<QtWebEngineCore::ProfileAdapter> profileAdapter; + QtWebEngineCore::WebContentsAdapterClient *adapterClient; Q_DECLARE_PUBLIC(QWebEngineDownloadRequest) }; diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 3088133f7..158f79eef 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -104,7 +104,9 @@ public: bool isVisible() const override { Q_UNREACHABLE(); } QWindow *window() const override { return nullptr; } void updateCursor(const QCursor &cursor) override - { /*setCursor(cursor);*/ + { + Q_UNUSED(cursor); + /*setCursor(cursor);*/ } void resize(int width, int height) override { @@ -115,8 +117,8 @@ public: void inputMethodStateChanged(bool, bool) override { } void setInputMethodHints(Qt::InputMethodHints) override { } void setClearColor(const QColor &) override { } - void adapterClientChanged(WebContentsAdapterClient *client) override { } - bool copySurface(const QRect &rect, const QSize &size, QImage &image) + void adapterClientChanged(WebContentsAdapterClient *) override { } + bool copySurface(const QRect &, const QSize &, QImage &) { Q_UNREACHABLE(); return false; @@ -2392,7 +2394,7 @@ void QWebEnginePage::setVisible(bool visible) } QWebEnginePage* QWebEnginePage::fromDownloadRequest(QWebEngineDownloadRequest *request) { - return static_cast<QWebEnginePagePrivate *>(request->d_ptr->m_adapterClient)->q_ptr; + return static_cast<QWebEnginePagePrivate *>(request->d_ptr->adapterClient)->q_ptr; } QDataStream &operator<<(QDataStream &stream, const QWebEngineHistory &history) diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp index 6f0e9d82c..d319356df 100644 --- a/src/core/api/qwebengineprofile.cpp +++ b/src/core/api/qwebengineprofile.cpp @@ -232,9 +232,9 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) itemPrivate->savePageFormat = static_cast<QWebEngineDownloadRequest::SavePageFormat>(info.savePageFormat); itemPrivate->isSavePageDownload = info.isSavePageDownload; if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::WidgetsClient) - itemPrivate->m_adapterClient = info.page; + itemPrivate->adapterClient = info.page; else - itemPrivate->m_adapterClient = nullptr; + itemPrivate->adapterClient = nullptr; QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q); diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp index 54da37309..c95a838af 100644 --- a/src/webenginequick/api/qquickwebengineprofile.cpp +++ b/src/webenginequick/api/qquickwebengineprofile.cpp @@ -249,9 +249,9 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) info.savePageFormat); itemPrivate->isSavePageDownload = info.isSavePageDownload; if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient) - itemPrivate->m_adapterClient = info.page; + itemPrivate->adapterClient = info.page; else - itemPrivate->m_adapterClient = nullptr; + itemPrivate->adapterClient = nullptr; QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q); diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 8a6cbb331..94669c4ca 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -207,7 +207,7 @@ class ConsolePage : public QWebEnginePage { public: ConsolePage(QWebEngineProfile* profile) : QWebEnginePage(profile) {} - virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) + void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) override { levels.append(level); messages.append(message); diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 667b99113..92ba16760 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -510,15 +510,10 @@ public: inputMethodPrivate->testContext = 0; } - virtual void commit() { - commitCallCount++; - } - - virtual void reset() { - resetCallCount++; - } + void commit() override { commitCallCount++; } + void reset() override { resetCallCount++; } - virtual void update(Qt::InputMethodQueries queries) + void update(Qt::InputMethodQueries queries) override { if (!qApp->focusObject()) return; diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index cd91bf5fc..8aabf927e 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -501,7 +501,7 @@ class ConsolePage : public QWebEnginePage public: ConsolePage(QObject* parent = 0) : QWebEnginePage(parent) {} - virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) + void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) override { levels.append(level); messages.append(message); @@ -710,7 +710,8 @@ public: QList<QNetworkRequest> requests; protected: - virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) { + QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) override + { requests.append(request); requestedUrls.append(request.url()); return QNetworkAccessManager::createRequest(op, request, outgoingData); @@ -977,7 +978,7 @@ public: JSPromptPage() {} - bool javaScriptPrompt(const QUrl &securityOrigin, const QString& msg, const QString& defaultValue, QString* result) + bool javaScriptPrompt(const QUrl &securityOrigin, const QString& msg, const QString& defaultValue, QString* result) override { if (msg == QLatin1String("test1")) { *result = QString(); @@ -2089,11 +2090,11 @@ public: { close(); } - virtual void abort() {} - virtual void close() {} + void abort() override {} + void close() override {} protected: - qint64 readData(char*, qint64) + qint64 readData(char*, qint64) override { return 0; } @@ -2121,7 +2122,7 @@ public: FakeNetworkManager(QObject* parent) : QNetworkAccessManager(parent) { } protected: - virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest& request, QIODevice* outgoingData) + QNetworkReply* createRequest(Operation op, const QNetworkRequest& request, QIODevice* outgoingData) override { QString url = request.url().toString(); if (op == QNetworkAccessManager::GetOperation) { @@ -2293,7 +2294,7 @@ public: int alerts; protected: - virtual void javaScriptAlert(const QUrl &securityOrigin, const QString &msg) + void javaScriptAlert(const QUrl &securityOrigin, const QString &msg) override { alerts++; QCOMPARE(securityOrigin, QUrl(QStringLiteral("http://test.origin.com/"))); @@ -2431,7 +2432,8 @@ signals: void repaintRequested(); protected: - bool event(QEvent *event) { + bool event(QEvent *event) override + { if (event->type() == QEvent::UpdateRequest) emit repaintRequested(); @@ -2503,7 +2505,7 @@ public: { } - virtual QNetworkReply* createRequest(Operation, const QNetworkRequest& request, QIODevice*) + QNetworkReply* createRequest(Operation, const QNetworkRequest& request, QIODevice*) override { QVariant cacheLoad = request.attribute(QNetworkRequest::CacheLoadControlAttribute); if (cacheLoad.isValid()) diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 64c763693..a91108946 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -276,7 +276,7 @@ void tst_QWebEngineProfile::disableCache() class RedirectingUrlSchemeHandler : public QWebEngineUrlSchemeHandler { public: - void requestStarted(QWebEngineUrlRequestJob *job) + void requestStarted(QWebEngineUrlRequestJob *job) override { job->redirect(QUrl(QStringLiteral("data:text/plain;charset=utf-8,") + job->requestUrl().fileName())); @@ -294,7 +294,7 @@ public: { } - void requestStarted(QWebEngineUrlRequestJob *job) + void requestStarted(QWebEngineUrlRequestJob *job) override { QBuffer *buffer = new QBuffer(job); buffer->setData(job->requestUrl().toString().toUtf8()); @@ -376,7 +376,7 @@ public: { } - void requestStarted(QWebEngineUrlRequestJob *job) + void requestStarted(QWebEngineUrlRequestJob *job) override { job->reply("text/plain;charset=utf-8", new StreamingIODevice(job)); } @@ -647,7 +647,7 @@ private: class XhrStatusUrlSchemeHandler : public QWebEngineUrlSchemeHandler { public: - void requestStarted(QWebEngineUrlRequestJob *job) + void requestStarted(QWebEngineUrlRequestJob *job) override { QString path = job->requestUrl().path(); if (path == "/") { @@ -725,7 +725,7 @@ void tst_QWebEngineProfile::urlSchemeHandlerXhrStatus() class ScriptsUrlSchemeHandler : public QWebEngineUrlSchemeHandler { public: - void requestStarted(QWebEngineUrlRequestJob *job) + void requestStarted(QWebEngineUrlRequestJob *job) override { auto *script = new QBuffer(job); script->setData(QByteArrayLiteral("window.test = 'SUCCESS';")); @@ -756,7 +756,7 @@ public: LongReplyUrlSchemeHandler(QObject *parent = nullptr) : QWebEngineUrlSchemeHandler(parent) {} ~LongReplyUrlSchemeHandler() {} - void requestStarted(QWebEngineUrlRequestJob *job) + void requestStarted(QWebEngineUrlRequestJob *job) override { QBuffer *buffer = new QBuffer(job); buffer->setData(QByteArray(128 * 1024, ' ') + diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp index 77e46b0bf..c1772461f 100644 --- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp +++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp @@ -162,7 +162,7 @@ void tst_QWebEngineSettings::javascriptClipboard() class NavigationRequestOverride : public QWebEnginePage { protected: - virtual bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) + bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override { Q_UNUSED(type); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 170afaafc..dc0efcfb6 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1802,20 +1802,11 @@ public: inputMethodPrivate->testContext = 0; } - virtual void showInputPanel() - { - m_visible = true; - } - virtual void hideInputPanel() - { - m_visible = false; - } - virtual bool isInputPanelVisible() const - { - return m_visible; - } + void showInputPanel() override { m_visible = true; } + void hideInputPanel() override { m_visible = false; } + bool isInputPanelVisible() const override { return m_visible; } - virtual void update(Qt::InputMethodQueries queries) + void update(Qt::InputMethodQueries queries) override { if (!qApp->focusObject()) return; |