forked from qt-creator/qt-creator
Move displayName from IEditor to IDocument
The display name is not editor instance specific, but belongs to the document. Change-Id: I3c936f04a86e10e6ca30063d85036d85b4b5880e Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -133,4 +133,31 @@ void IDocument::setFilePath(const QString &filePath)
|
||||
emit changed();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the string to display for this document, e.g. in the open document combo box
|
||||
and pane.
|
||||
\sa setDisplayName()
|
||||
*/
|
||||
QString IDocument::displayName() const
|
||||
{
|
||||
if (!m_displayName.isEmpty())
|
||||
return m_displayName;
|
||||
return QFileInfo(m_filePath).fileName();
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the string that is displayed for this document, e.g. in the open document combo box
|
||||
and pane, to \a name. Defaults to the file name of the file path for this document.
|
||||
You can reset the display name to the default by passing an empty string.
|
||||
\sa displayName()
|
||||
\sa filePath()
|
||||
*/
|
||||
void IDocument::setDisplayName(const QString &name)
|
||||
{
|
||||
if (name == m_displayName)
|
||||
return;
|
||||
m_displayName = name;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Reference in New Issue
Block a user