forked from qt-creator/qt-creator
Debugger: Suggest a non-empty name when saving scratch buffers
The user needs some clue what buffer is about to be saved, even if this is not a real file name. Task-number: QTCREATORBUG-14602 Change-Id: I7d81a50079d8aa1a3b2ba63130d54515667a6663 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
This commit is contained in:
@@ -3088,6 +3088,12 @@ void openTextEditor(const QString &titlePattern0, const QString &contents)
|
||||
IEditor *editor = EditorManager::openEditorWithContents(
|
||||
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents.toUtf8(), QString(),
|
||||
EditorManager::IgnoreNavigationHistory);
|
||||
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {
|
||||
QString suggestion = titlePattern;
|
||||
if (!suggestion.contains(QLatin1Char('.')))
|
||||
suggestion.append(QLatin1String(".txt"));
|
||||
textEditor->textDocument()->setSuggestedFileName(suggestion);
|
||||
}
|
||||
QTC_ASSERT(editor, return);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user