forked from qt-creator/qt-creator
Add some useful methods to document model.
Change-Id: I3082ec561fad7740600caaa959824387a7e9e2fb Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -291,6 +291,22 @@ QList<IDocument *> DocumentModel::openedDocuments() const
|
||||
return d->m_editors.keys();
|
||||
}
|
||||
|
||||
IDocument *DocumentModel::documentForFilePath(const QString &filePath) const
|
||||
{
|
||||
int index = indexOfFilePath(filePath);
|
||||
if (index < 0)
|
||||
return 0;
|
||||
return d->m_documents.at(index)->document;
|
||||
}
|
||||
|
||||
QList<IEditor *> DocumentModel::editorsForFilePath(const QString &filePath) const
|
||||
{
|
||||
IDocument *document = documentForFilePath(filePath);
|
||||
if (document)
|
||||
return editorsForDocument(document);
|
||||
return QList<IEditor *>();
|
||||
}
|
||||
|
||||
QModelIndex DocumentModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
|
@@ -81,6 +81,8 @@ public:
|
||||
Entry *entryForDocument(IDocument *document) const;
|
||||
QList<IDocument *> openedDocuments() const;
|
||||
|
||||
IDocument *documentForFilePath(const QString &filePath) const;
|
||||
QList<IEditor *> editorsForFilePath(const QString &filePath) const;
|
||||
QList<IEditor *> editorsForDocument(IDocument *document) const;
|
||||
QList<IEditor *> editorsForDocuments(const QList<IDocument *> &documents) const;
|
||||
QList<IEditor *> oneEditorForEachOpenedDocument() const;
|
||||
|
Reference in New Issue
Block a user