From e1251f4ac383522ee5e5565491bfda0270faeae7 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Sat, 3 Feb 2024 00:54:35 +0100 Subject: [PATCH] CompilerExplorer: Replace QSharedPointer with std::shared_ptr According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews QSharedPointer impl is poor and it's going to be removed from Qt 7. Change-Id: I591de84b86f91adda73848729149e29004277df2 Reviewed-by: Marcus Tillmanns Reviewed-by: --- src/plugins/compilerexplorer/api/request.h | 4 ++-- src/plugins/compilerexplorer/compilerexplorereditor.cpp | 2 +- src/plugins/compilerexplorer/compilerexplorereditor.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/compilerexplorer/api/request.h b/src/plugins/compilerexplorer/api/request.h index 73c37570031..48823b65b98 100644 --- a/src/plugins/compilerexplorer/api/request.h +++ b/src/plugins/compilerexplorer/api/request.h @@ -49,7 +49,7 @@ template QFuture request( QNetworkAccessManager *networkManager, QNetworkRequest &req, - std::function>)> callback, + std::function>)> callback, QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation, const QByteArray &payload = {}) { @@ -60,7 +60,7 @@ QFuture request( .toUtf8(); req.setRawHeader("User-Agent", userAgent); - QSharedPointer> p(new QPromise); + std::shared_ptr> p(new QPromise); p->start(); // For logging purposes only diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index df1d04a79e2..9b9eb242ed9 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.cpp +++ b/src/plugins/compilerexplorer/compilerexplorereditor.cpp @@ -547,7 +547,7 @@ void CompilerWidget::doCompile() m_compileWatcher->setFuture(f); } -EditorWidget::EditorWidget(const QSharedPointer &document, +EditorWidget::EditorWidget(const std::shared_ptr &document, QUndoStack *undoStack, TextEditorActionHandler &actionHandler, QWidget *parent) diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.h b/src/plugins/compilerexplorer/compilerexplorereditor.h index d7f97d3a7ca..c9c02e5215f 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.h +++ b/src/plugins/compilerexplorer/compilerexplorereditor.h @@ -221,7 +221,7 @@ class EditorWidget : public Utils::FancyMainWindow { Q_OBJECT public: - EditorWidget(const QSharedPointer &document, + EditorWidget(const std::shared_ptr &document, QUndoStack *undoStack, TextEditor::TextEditorActionHandler &actionHandler, QWidget *parent = nullptr); @@ -251,7 +251,7 @@ protected: QVariantMap windowStateCallback(); private: - QSharedPointer m_document; + std::shared_ptr m_document; QUndoStack *m_undoStack; TextEditor::TextEditorActionHandler &m_actionHandler; @@ -265,10 +265,10 @@ public: Editor(TextEditor::TextEditorActionHandler &actionHandler); ~Editor(); - Core::IDocument *document() const override { return m_document.data(); } + Core::IDocument *document() const override { return m_document.get(); } QWidget *toolBar() override; - QSharedPointer m_document; + std::shared_ptr m_document; QUndoStack m_undoStack; std::unique_ptr m_toolBar; };