aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmljstools
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-11-16 17:24:51 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2023-11-17 10:01:34 +0000
commit5d6fc1fc3bec1bac6cdbd4aec65bd63658d4ac0a (patch)
tree3ddeb87c0d24f267f0981ea9b93533f410791b7e /src/plugins/qmljstools
parent1c8ac2e7d35002d84de9871d8c7130d145cb42f4 (diff)
TextEditor: Remove RefactoringFile::m_data
There is no use for a generic data member. Change-Id: Iabfbc0587db2cffcc1c19baed832aa866f696ffe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/qmljstools')
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.cpp15
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.h5
2 files changed, 7 insertions, 13 deletions
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
index 24bd14f52b0..617d5292e99 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
@@ -36,7 +36,7 @@ QmlJSRefactoringChanges::QmlJSRefactoringChanges(ModelManagerInterface *modelMan
TextEditor::RefactoringFilePtr QmlJSRefactoringChanges::file(const Utils::FilePath &filePath) const
{
- return QmlJSRefactoringFilePtr(new QmlJSRefactoringFile(filePath, m_data));
+ return QmlJSRefactoringFilePtr(new QmlJSRefactoringFile(filePath, m_data.staticCast<QmlJSRefactoringChangesData>()));
}
QmlJSRefactoringFilePtr QmlJSRefactoringChanges::qmlJSFile(const Utils::FilePath &filePath) const
@@ -61,8 +61,8 @@ QmlJSRefactoringChangesData *QmlJSRefactoringChanges::data() const
}
QmlJSRefactoringFile::QmlJSRefactoringFile(
- const Utils::FilePath &filePath, const QSharedPointer<TextEditor::RefactoringChangesData> &data)
- : RefactoringFile(filePath, data)
+ const Utils::FilePath &filePath, const QSharedPointer<QmlJSRefactoringChangesData> &data)
+ : RefactoringFile(filePath), m_data(data)
{
// the RefactoringFile is invalid if its not for a file with qml or js code
if (ModelManagerInterface::guessLanguageOfFile(filePath) == Dialect::NoLanguage)
@@ -81,7 +81,7 @@ Document::Ptr QmlJSRefactoringFile::qmljsDocument() const
{
if (!m_qmljsDocument) {
const QString source = document()->toPlainText();
- const Snapshot &snapshot = data()->m_snapshot;
+ const Snapshot &snapshot = m_data->m_snapshot;
Document::MutablePtr newDoc
= snapshot.documentFromSource(source,
@@ -139,16 +139,11 @@ bool QmlJSRefactoringFile::isCursorOn(SourceLocation loc) const
return pos >= loc.begin() && pos <= loc.end();
}
-QmlJSRefactoringChangesData *QmlJSRefactoringFile::data() const
-{
- return static_cast<QmlJSRefactoringChangesData *>(m_data.data());
-}
-
void QmlJSRefactoringFile::fileChanged()
{
QTC_ASSERT(!m_filePath.isEmpty(), return);
m_qmljsDocument.clear();
- data()->m_modelManager->updateSourceFiles({filePath()}, true);
+ m_data->m_modelManager->updateSourceFiles({filePath()}, true);
}
void QmlJSRefactoringFile::indentSelection(const QTextCursor &selection,
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.h b/src/plugins/qmljstools/qmljsrefactoringchanges.h
index 8c5cf8501ae..11d23b382d6 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.h
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.h
@@ -36,11 +36,9 @@ public:
private:
QmlJSRefactoringFile(const Utils::FilePath &filePath,
- const QSharedPointer<TextEditor::RefactoringChangesData> &data);
+ const QSharedPointer<QmlJSRefactoringChangesData> &data);
QmlJSRefactoringFile(TextEditor::TextEditorWidget *editor, QmlJS::Document::Ptr document);
- QmlJSRefactoringChangesData *data() const;
-
void fileChanged() override;
void indentSelection(const QTextCursor &selection,
const TextEditor::TextDocument *textDocument) const override;
@@ -48,6 +46,7 @@ private:
const TextEditor::TextDocument *textDocument) const override;
mutable QmlJS::Document::Ptr m_qmljsDocument;
+ QSharedPointer<QmlJSRefactoringChangesData> m_data;
friend class QmlJSRefactoringChanges;
};