forked from qt-creator/qt-creator
EditLocation: Use QByteArray directly
The `state` in the edit location is used to save the editor state, which is a QByteArray, so there is no use in saving it in a variant instead of a QByteArray directly. Change-Id: I987a7d1bbb66b2cb1c1f4c7cfe0451742ea5bca2 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -3487,7 +3487,7 @@ void EditorManager::setLastEditLocation(const IEditor* editor)
|
|||||||
location.document = document;
|
location.document = document;
|
||||||
location.filePath = document->filePath();
|
location.filePath = document->filePath();
|
||||||
location.id = document->id();
|
location.id = document->id();
|
||||||
location.state = QVariant(state);
|
location.state = state;
|
||||||
|
|
||||||
d->m_globalLastEditLocation = location;
|
d->m_globalLastEditLocation = location;
|
||||||
}
|
}
|
||||||
|
@@ -241,7 +241,7 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
|
|||||||
location.document = document;
|
location.document = document;
|
||||||
location.filePath = document->filePath();
|
location.filePath = document->filePath();
|
||||||
location.id = document->id();
|
location.id = document->id();
|
||||||
location.state = QVariant(state);
|
location.state = state;
|
||||||
|
|
||||||
for (int i = 0; i < history.size(); ++i) {
|
for (int i = 0; i < history.size(); ++i) {
|
||||||
const EditLocation &item = history.at(i);
|
const EditLocation &item = history.at(i);
|
||||||
@@ -472,7 +472,7 @@ void EditorView::addCurrentPositionToNavigationHistory(const QByteArray &saveSta
|
|||||||
location.document = document;
|
location.document = document;
|
||||||
location.filePath = document->filePath();
|
location.filePath = document->filePath();
|
||||||
location.id = document->id();
|
location.id = document->id();
|
||||||
location.state = QVariant(state);
|
location.state = state;
|
||||||
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
|
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
|
||||||
m_navigationHistory.insert(m_currentNavigationHistoryPosition, location);
|
m_navigationHistory.insert(m_currentNavigationHistoryPosition, location);
|
||||||
++m_currentNavigationHistoryPosition;
|
++m_currentNavigationHistoryPosition;
|
||||||
@@ -527,7 +527,7 @@ void EditorView::updateCurrentPositionInNavigationHistory()
|
|||||||
location->document = document;
|
location->document = document;
|
||||||
location->filePath = document->filePath();
|
location->filePath = document->filePath();
|
||||||
location->id = document->id();
|
location->id = document->id();
|
||||||
location->state = QVariant(editor->saveState());
|
location->state = editor->saveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool fileNameWasRemoved(const FilePath &filePath)
|
static bool fileNameWasRemoved(const FilePath &filePath)
|
||||||
@@ -558,7 +558,7 @@ void EditorView::goBackInNavigationHistory()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editor->restoreState(location.state.toByteArray());
|
editor->restoreState(location.state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateNavigatorActions();
|
updateNavigatorActions();
|
||||||
@@ -589,7 +589,7 @@ void EditorView::goForwardInNavigationHistory()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editor->restoreState(location.state.toByteArray());
|
editor->restoreState(location.state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_currentNavigationHistoryPosition >= m_navigationHistory.size())
|
if (m_currentNavigationHistoryPosition >= m_navigationHistory.size())
|
||||||
@@ -615,7 +615,7 @@ void EditorView::goToEditLocation(const EditLocation &location)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (editor) {
|
if (editor) {
|
||||||
editor->restoreState(location.state.toByteArray());
|
editor->restoreState(location.state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ struct EditLocation {
|
|||||||
QPointer<IDocument> document;
|
QPointer<IDocument> document;
|
||||||
Utils::FilePath filePath;
|
Utils::FilePath filePath;
|
||||||
Utils::Id id;
|
Utils::Id id;
|
||||||
QVariant state;
|
QByteArray state;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SplitterOrView;
|
class SplitterOrView;
|
||||||
|
Reference in New Issue
Block a user