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 <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2024-02-03 00:54:35 +01:00
parent b50e77e858
commit e1251f4ac3
3 changed files with 7 additions and 7 deletions

View File

@@ -49,7 +49,7 @@ template<typename Result>
QFuture<Result> request( QFuture<Result> request(
QNetworkAccessManager *networkManager, QNetworkAccessManager *networkManager,
QNetworkRequest &req, QNetworkRequest &req,
std::function<void(const QByteArray &, QSharedPointer<QPromise<Result>>)> callback, std::function<void(const QByteArray &, std::shared_ptr<QPromise<Result>>)> callback,
QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation, QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation,
const QByteArray &payload = {}) const QByteArray &payload = {})
{ {
@@ -60,7 +60,7 @@ QFuture<Result> request(
.toUtf8(); .toUtf8();
req.setRawHeader("User-Agent", userAgent); req.setRawHeader("User-Agent", userAgent);
QSharedPointer<QPromise<Result>> p(new QPromise<Result>); std::shared_ptr<QPromise<Result>> p(new QPromise<Result>);
p->start(); p->start();
// For logging purposes only // For logging purposes only

View File

@@ -547,7 +547,7 @@ void CompilerWidget::doCompile()
m_compileWatcher->setFuture(f); m_compileWatcher->setFuture(f);
} }
EditorWidget::EditorWidget(const QSharedPointer<JsonSettingsDocument> &document, EditorWidget::EditorWidget(const std::shared_ptr<JsonSettingsDocument> &document,
QUndoStack *undoStack, QUndoStack *undoStack,
TextEditorActionHandler &actionHandler, TextEditorActionHandler &actionHandler,
QWidget *parent) QWidget *parent)

View File

@@ -221,7 +221,7 @@ class EditorWidget : public Utils::FancyMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
EditorWidget(const QSharedPointer<JsonSettingsDocument> &document, EditorWidget(const std::shared_ptr<JsonSettingsDocument> &document,
QUndoStack *undoStack, QUndoStack *undoStack,
TextEditor::TextEditorActionHandler &actionHandler, TextEditor::TextEditorActionHandler &actionHandler,
QWidget *parent = nullptr); QWidget *parent = nullptr);
@@ -251,7 +251,7 @@ protected:
QVariantMap windowStateCallback(); QVariantMap windowStateCallback();
private: private:
QSharedPointer<JsonSettingsDocument> m_document; std::shared_ptr<JsonSettingsDocument> m_document;
QUndoStack *m_undoStack; QUndoStack *m_undoStack;
TextEditor::TextEditorActionHandler &m_actionHandler; TextEditor::TextEditorActionHandler &m_actionHandler;
@@ -265,10 +265,10 @@ public:
Editor(TextEditor::TextEditorActionHandler &actionHandler); Editor(TextEditor::TextEditorActionHandler &actionHandler);
~Editor(); ~Editor();
Core::IDocument *document() const override { return m_document.data(); } Core::IDocument *document() const override { return m_document.get(); }
QWidget *toolBar() override; QWidget *toolBar() override;
QSharedPointer<JsonSettingsDocument> m_document; std::shared_ptr<JsonSettingsDocument> m_document;
QUndoStack m_undoStack; QUndoStack m_undoStack;
std::unique_ptr<QToolBar> m_toolBar; std::unique_ptr<QToolBar> m_toolBar;
}; };