void GLSLTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { TextEditor::BaseTextEditorWidget::setFontSettings(fs); Highlighter *highlighter = qobject_cast<Highlighter*>(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; /* NumberFormat, StringFormat, TypeFormat, KeywordFormat, LabelFormat, CommentFormat, VisualWhitespace, */ static QVector<TextEditor::TextStyle> categories; if (categories.isEmpty()) { categories << TextEditor::C_NUMBER << TextEditor::C_STRING << TextEditor::C_TYPE << TextEditor::C_KEYWORD << TextEditor::C_OPERATOR << TextEditor::C_PREPROCESSOR << TextEditor::C_LABEL << TextEditor::C_COMMENT << TextEditor::C_DOXYGEN_COMMENT << TextEditor::C_DOXYGEN_TAG << TextEditor::C_VISUAL_WHITESPACE << TextEditor::C_REMOVED_LINE; } highlighter->setFormats(fs.toTextCharFormats(categories)); highlighter->rehighlight(); }
void ProFileEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { TextEditor::BaseTextEditorWidget::setFontSettings(fs); ProFileHighlighter *highlighter = qobject_cast<ProFileHighlighter*>(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; static QVector<TextEditor::TextStyle> categories; if (categories.isEmpty()) { categories << TextEditor::C_TYPE << TextEditor::C_KEYWORD << TextEditor::C_COMMENT << TextEditor::C_VISUAL_WHITESPACE; } highlighter->setFormats(fs.toTextCharFormats(categories)); highlighter->rehighlight(); }
void CMakeEditor::setFontSettings(const TextEditor::FontSettings &fs) { TextEditor::BaseTextEditor::setFontSettings(fs); CMakeHighlighter *highlighter = qobject_cast<CMakeHighlighter*>(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; static QVector<QString> categories; if (categories.isEmpty()) { categories << QLatin1String(TextEditor::Constants::C_LABEL) // variables << QLatin1String(TextEditor::Constants::C_LINK) // functions << QLatin1String(TextEditor::Constants::C_COMMENT) << QLatin1String(TextEditor::Constants::C_STRING); } const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories); highlighter->setFormats(formats.constBegin(), formats.constEnd()); highlighter->rehighlight(); }
void ProFileEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { TextEditor::BaseTextEditorWidget::setFontSettings(fs); ProFileHighlighter *highlighter = qobject_cast<ProFileHighlighter*>(baseTextDocument()->syntaxHighlighter()); if (!highlighter) return; static QVector<QString> categories; if (categories.isEmpty()) { categories << QLatin1String(TextEditor::Constants::C_TYPE) << QLatin1String(TextEditor::Constants::C_KEYWORD) << QLatin1String(TextEditor::Constants::C_COMMENT) << QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE); } const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories); highlighter->setFormats(formats.constBegin(), formats.constEnd()); highlighter->rehighlight(); }
/** QtCreator has own fonts&color settings. Highlighter wants get access to this settings before highlightBlock() called first time. Settings provided by PyEditor::EditorWidget class. */ void Highlighter::setFontSettings(const TextEditor::FontSettings &fs) { _formats = fs.toTextCharFormats(FORMAT_CATEGORIES); rehighlight(); }