From 3808372493fd2c3c3f1d3843199c96221ff6adf5 Mon Sep 17 00:00:00 2001 From: Nico Miguelino Date: Wed, 11 Sep 2024 20:02:23 -0700 Subject: [PATCH] chore: update deprecated Qt code (#2065) --- webview/ScreenlyWebview.pro | 2 +- webview/src/main.cpp | 1 - webview/src/mainwindow.cpp | 7 ++----- webview/src/view.cpp | 2 +- webview/src/view.h | 1 + 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/webview/ScreenlyWebview.pro b/webview/ScreenlyWebview.pro index 370d748f8..82aaf6989 100644 --- a/webview/ScreenlyWebview.pro +++ b/webview/ScreenlyWebview.pro @@ -1,6 +1,6 @@ TEMPLATE = app -QT += webengine webenginewidgets dbus +QT += webenginecore webenginewidgets dbus CONFIG += c++11 SOURCES += src/main.cpp \ diff --git a/webview/src/main.cpp b/webview/src/main.cpp index 6a54df665..ed5d61f7b 100644 --- a/webview/src/main.cpp +++ b/webview/src/main.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include "mainwindow.h" diff --git a/webview/src/mainwindow.cpp b/webview/src/mainwindow.cpp index 17c109b3f..e26bb67f3 100644 --- a/webview/src/mainwindow.cpp +++ b/webview/src/mainwindow.cpp @@ -7,12 +7,9 @@ MainWindow::MainWindow() : QMainWindow() { - QWebEngineSettings::globalSettings() -> setAttribute(QWebEngineSettings::LocalStorageEnabled, true); - - // for QT5.10 and higher - QWebEngineSettings::globalSettings() -> setAttribute(QWebEngineSettings::ShowScrollBars, false); - view = new View(this); + view -> settings() -> setAttribute(QWebEngineSettings::LocalStorageEnabled, false); + view -> settings() -> setAttribute(QWebEngineSettings::ShowScrollBars, false); setCentralWidget(view); } diff --git a/webview/src/view.cpp b/webview/src/view.cpp index 9d1fd30b0..543c47512 100644 --- a/webview/src/view.cpp +++ b/webview/src/view.cpp @@ -76,5 +76,5 @@ void View::handleAuthRequest(QNetworkReply* reply, QAuthenticator* auth) { Q_UNUSED(reply) Q_UNUSED(auth) - load(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, "res/access_denied.html"))); + load(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::AppDataLocation, "res/access_denied.html"))); } diff --git a/webview/src/view.h b/webview/src/view.h index a76c7bd16..810e7ff11 100644 --- a/webview/src/view.h +++ b/webview/src/view.h @@ -4,6 +4,7 @@ #include #include #include +#include class View : public QWebEngineView {