forked from qt-creator/qt-creator
Snippets: Check for content change on apply
Cannot rely on the focus out event (on Mac) in the situation where a snippet is added/edited and the dialog is immediately confirmed. Reviewed-by: con Task-number: QTCREATORBUG-3464
This commit is contained in:
@@ -73,8 +73,10 @@ void SnippetEditor::setSyntaxHighlighter(TextEditor::SyntaxHighlighter *highligh
|
||||
|
||||
void SnippetEditor::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
if (event->reason() != Qt::ActiveWindowFocusReason && document()->isModified())
|
||||
if (event->reason() != Qt::ActiveWindowFocusReason && document()->isModified()) {
|
||||
document()->setModified(false);
|
||||
emit snippetContentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
BaseTextEditorEditable *SnippetEditor::createEditableInterface()
|
||||
|
||||
@@ -387,6 +387,9 @@ void SnippetsSettingsPagePrivate::apply()
|
||||
if (settingsChanged())
|
||||
writeSettings();
|
||||
|
||||
if (currentEditor()->document()->isModified())
|
||||
setSnippetContent();
|
||||
|
||||
if (m_snippetsCollectionChanged) {
|
||||
SnippetsCollection::instance()->synchronize();
|
||||
m_snippetsCollectionChanged = false;
|
||||
|
||||
Reference in New Issue
Block a user