diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2023-08-18 16:01:36 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-21 20:03:50 +0000 |
commit | c71f4b0d6fcd7b14c4c24141716a2e5fc9fdd246 (patch) | |
tree | 92b565778c4b9f2fa4d1e0775e69832f59577aee /src | |
parent | 321e8a44d2a0846aa3ac768ae90976c23d7233a3 (diff) |
Port away from QScopedPointer::take() - trivial case
This API was deprecated in Qt 6.0. Use std::unique_ptr instead.
Change-Id: I6bdb4db129b6a669eeb3fac6b4c0b097087ec082
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit f65a88d715a31a0902b1b96761babacf6b1e2f50)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/clipboard_qt.cpp | 8 | ||||
-rw-r--r-- | src/core/net/qrc_url_scheme_handler.cpp | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 009235a72..fe56a5db1 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -27,6 +27,8 @@ #include <QImageWriter> #include <QMimeData> +#include <memory> + namespace QtWebEngineCore { static void registerMetaTypes() @@ -60,12 +62,12 @@ using namespace QtWebEngineCore; namespace { -QScopedPointer<QMimeData> uncommittedData; +std::unique_ptr<QMimeData> uncommittedData; QMimeData *getUncommittedData() { if (!uncommittedData) uncommittedData.reset(new QMimeData); - return uncommittedData.data(); + return uncommittedData.get(); } } // namespace @@ -104,7 +106,7 @@ void ClipboardQt::WritePortableAndPlatformRepresentations(ui::ClipboardBuffer ty // Commit the accumulated data. if (uncommittedData) - QGuiApplication::clipboard()->setMimeData(uncommittedData.take(), + QGuiApplication::clipboard()->setMimeData(uncommittedData.release(), type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp index ab66acac0..a8b4e4388 100644 --- a/src/core/net/qrc_url_scheme_handler.cpp +++ b/src/core/net/qrc_url_scheme_handler.cpp @@ -10,6 +10,8 @@ #include <QMimeDatabase> #include <QMimeType> +#include <memory> + namespace QtWebEngineCore { void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) @@ -22,7 +24,7 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QUrl requestUrl = job->requestUrl(); QString requestPath = requestUrl.path(); - QScopedPointer<QFile> file(new QFile(':' + requestPath, job)); + auto file = std::make_unique<QFile>(':' + requestPath, job); if (!file->exists() || file->size() == 0) { qWarning("QResource '%s' not found or is empty", qUtf8Printable(requestPath)); job->fail(QWebEngineUrlRequestJob::UrlNotFound); @@ -32,9 +34,9 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) QMimeDatabase mimeDatabase; QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo); if (mimeType.name() == QStringLiteral("application/x-extension-html")) - job->reply("text/html", file.take()); + job->reply("text/html", file.release()); else - job->reply(mimeType.name().toUtf8(), file.take()); + job->reply(mimeType.name().toUtf8(), file.release()); } } // namespace QtWebEngineCore |