Restore correct font after the Cell Edit dock is set to plain text

QScintilla seems to reset many settings when setLexer is called, so we
need to restore the font when switching from the lexer modes to the mode
without lexer (plain text).

See issue #1793.
This commit is contained in:
mgrojo
2019-03-10 23:51:43 +01:00
parent 3e92ec2b3b
commit d4ef409711
2 changed files with 6 additions and 3 deletions

View File

@@ -36,9 +36,9 @@ void DockTextEdit::reloadSettings()
reloadLexerSettings(xmlLexer);
// Set the databrowser font for the plain text editor.
QFont textFont(Settings::getValue("databrowser", "font").toString());
textFont.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
setFont(textFont);
plainTextFont = QFont(Settings::getValue("databrowser", "font").toString());
plainTextFont.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
setFont(plainTextFont);
setupSyntaxHighlightingFormat(jsonLexer, "comment", QsciLexerJSON::CommentLine);
setupSyntaxHighlightingFormat(jsonLexer, "comment", QsciLexerJSON::CommentBlock);
@@ -84,6 +84,8 @@ void DockTextEdit::setLanguage(Language lang)
case PlainText: {
setLexer(nullptr);
setFolding(QsciScintilla::NoFoldStyle);
// This appears to be reset by setLexer
setFont(plainTextFont);
break;
}
case JSON:

View File

@@ -42,6 +42,7 @@ protected:
static QsciLexerXML* xmlLexer;
private:
Language m_language;
QFont plainTextFont;
};
#endif