forked from qt-creator/qt-creator
Editor: avoid FontSettings copies
Change-Id: I1ffd9aa21a38404bdf5e2f402b61ce57a023e83d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Internal {
|
|||||||
// Retrieve the comment char format from the text editor.
|
// Retrieve the comment char format from the text editor.
|
||||||
static QTextCharFormat commentFormat()
|
static QTextCharFormat commentFormat()
|
||||||
{
|
{
|
||||||
const TextEditor::FontSettings settings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
const TextEditor::FontSettings &settings = TextEditor::TextEditorSettings::instance()->fontSettings();
|
||||||
return settings.toTextCharFormat(TextEditor::C_COMMENT);
|
return settings.toTextCharFormat(TextEditor::C_COMMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ using FormatRanges = QList<QTextLayout::FormatRange>;
|
|||||||
|
|
||||||
QTextCharFormat toFormat(const TextStyle &style)
|
QTextCharFormat toFormat(const TextStyle &style)
|
||||||
{
|
{
|
||||||
const static FontSettings fontSettings = TextEditorSettings::fontSettings();
|
const static FontSettings &fontSettings = TextEditorSettings::fontSettings();
|
||||||
auto format = fontSettings.toTextCharFormat(style);
|
auto format = fontSettings.toTextCharFormat(style);
|
||||||
if (style == C_FUNCTION)
|
if (style == C_FUNCTION)
|
||||||
format.setFontWeight(QFont::Bold); // is explicitly set by the ksyntax format definition
|
format.setFontWeight(QFont::Bold); // is explicitly set by the ksyntax format definition
|
||||||
|
|||||||
Reference in New Issue
Block a user