Core: Add methods to retrieve contents from IDocument

This is very helpful for dynamic extra compiler support (e.g. uic,
flex, ...).

Change-Id: I5a49b0b39a0f1fbc7834701d60a68ef441172969
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-01-15 15:24:49 +01:00
parent fc485e6b86
commit 5182f2ffb2
2 changed files with 16 additions and 0 deletions

View File

@@ -150,6 +150,15 @@ IDocument::OpenResult IDocument::open(QString *errorString, const QString &fileN
return OpenResult::CannotHandle;
}
/*!
* Returns the current contents of the document. The base implementation returns an empty
* QByteArray.
*/
QByteArray IDocument::contents() const
{
return QByteArray();
}
/*!
Used for example by EditorManager::openEditorWithContents() to set the contents
of this document.

View File

@@ -95,6 +95,8 @@ public:
virtual OpenResult open(QString *errorString, const QString &fileName, const QString &realFileName);
virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0;
virtual QByteArray contents() const;
virtual bool setContents(const QByteArray &contents);
const Utils::FileName &filePath() const;
@@ -133,7 +135,12 @@ public:
InfoBar *infoBar();
signals:
// For meta data changes: file name, modified state, ...
void changed();
// For changes in the contents of the document
void contentsChanged();
void mimeTypeChanged();
void aboutToReload();