forked from qt-creator/qt-creator
Editors: Don't use model index outside of model/view.
The model index is an internal detail of the model/view and shouldn't be used outside that context. Change-Id: I2c1f742fff427484f6ff244dd3e0d8428a7318d3 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -1999,19 +1999,19 @@ int FakeVimPluginPrivate::currentFile() const
|
||||
{
|
||||
OpenEditorsModel *model = EditorManager::instance()->openedEditorsModel();
|
||||
IEditor *editor = EditorManager::currentEditor();
|
||||
return model->indexOf(editor).row();
|
||||
return model->indexOfEditor(editor);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::switchToFile(int n)
|
||||
{
|
||||
EditorManager *editorManager = ICore::editorManager();
|
||||
OpenEditorsModel *model = editorManager->openedEditorsModel();
|
||||
int size = model->rowCount();
|
||||
int size = model->openDocumentCount();
|
||||
QTC_ASSERT(size, return);
|
||||
n = n % size;
|
||||
if (n < 0)
|
||||
n += size;
|
||||
editorManager->activateEditorForIndex(model->index(n, 0));
|
||||
editorManager->activateEditorForEntry(model->entries().at(n));
|
||||
}
|
||||
|
||||
ExCommandMap &FakeVimExCommandsPage::exCommandMap()
|
||||
|
||||
Reference in New Issue
Block a user