KSyntaxHighlighting
format.cpp
49QColor FormatPrivate::color(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const
56 return QColor::fromRgba(style.*styleColor ? style.*styleColor : (theme.*themeColor)(defaultStyle));
59bool FormatPrivate::hasColor(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const
62 return color(theme, styleColor, themeColor) != QColor::fromRgba((theme.*themeColor)(Theme::Normal)) && (style.*styleColor || (theme.*themeColor)(defaultStyle) || styleOverride(theme).*styleColor);
113 // use QColor::fromRgba for background QRgb => QColor conversion to avoid unset colors == black!
114 return (!hasTextColor(theme)) && (!hasBackgroundColor(theme)) && (selectedTextColor(theme).rgba() == theme.selectedTextColor(Theme::Normal))
115 && (selectedBackgroundColor(theme).rgba() == (theme.selectedBackgroundColor(Theme::Normal))) && (isBold(theme) == theme.isBold(Theme::Normal))
116 && (isItalic(theme) == theme.isItalic(Theme::Normal)) && (isUnderline(theme) == theme.isUnderline(Theme::Normal))
147 return d->color(theme, &TextStyleData::selectedBackgroundColor, &Theme::selectedBackgroundColor);
183 return d->style.hasStrikeThrough ? d->style.strikeThrough : theme.isStrikeThrough(d->defaultStyle);
Describes the format to be used for a specific text fragment.
Definition format.h:28
bool hasSelectedTextColorOverride() const
Returns true if the syntax definition file specifies a value for the selected text color attribute.
Definition format.cpp:221
bool hasBackgroundColorOverride() const
Returns true if the syntax definition file sets a value for the background color attribute and,...
Definition format.cpp:216
bool hasBoldOverride() const
Returns true if the syntax definition file sets a value for the bold text attribute and,...
Definition format.cpp:191
bool isUnderline(const Theme &theme) const
Returns true if the combination of this format and the given theme results in underlined text.
Definition format.cpp:168
QString name() const
The name of this format as used in the syntax definition file.
Definition format.cpp:96
bool hasTextColorOverride() const
Returns true if the syntax definition file sets a value for the foreground text color attribute and,...
Definition format.cpp:211
bool isDefaultTextStyle(const Theme &theme) const
Returns true if the combination of this format and the theme theme do not change the default text for...
Definition format.cpp:111
QColor textColor(const Theme &theme) const
Returns the foreground color of the combination of this format and the given theme.
Definition format.cpp:125
QColor selectedBackgroundColor(const Theme &theme) const
Returns the background color of selected text of the combination of this format and the given theme.
Definition format.cpp:145
bool hasBackgroundColor(const Theme &theme) const
Returns true if the combination of this format and the theme theme change the background color compar...
Definition format.cpp:135
Theme::TextStyle textStyle() const
Returns the underlying TextStyle of this Format.
Definition format.cpp:106
bool spellCheck() const
Returns whether characters with this format should be spell checked.
Definition format.cpp:186
bool isBold(const Theme &theme) const
Returns true if the combination of this format and the given theme results in bold text formatting.
Definition format.cpp:150
bool hasSelectedBackgroundColorOverride() const
Returns true if the syntax definition file specifies a value for the selected background color attrib...
Definition format.cpp:226
QColor backgroundColor(const Theme &theme) const
Returns the background color of the combination of this format and the given theme.
Definition format.cpp:140
bool hasItalicOverride() const
Returns true if the syntax definition file sets a value for the italic text attribute and,...
Definition format.cpp:196
bool hasStrikeThroughOverride() const
Returns true if the syntax definition file specifies a value for the struck through text attribute.
Definition format.cpp:206
QColor selectedTextColor(const Theme &theme) const
Returns the foreground color for selected text of the combination of this format and the given theme.
Definition format.cpp:130
bool isItalic(const Theme &theme) const
Returns true if the combination of this format and the given theme results in italic text formatting.
Definition format.cpp:159
bool hasUnderlineOverride() const
Returns true if the syntax definition file sets a value for the underlined text attribute and,...
Definition format.cpp:201
bool isStrikeThrough(const Theme &theme) const
Returns true if the combination of this format and the given theme results in struck through text.
Definition format.cpp:177
bool hasTextColor(const Theme &theme) const
Returns true if the combination of this format and the theme theme change the foreground color compar...
Definition format.cpp:120
bool isStrikeThrough(TextStyle style) const
Returns whether the given style should be shown struck through.
Definition theme.cpp:97
QRgb textColor(TextStyle style) const
Returns the text color to be used for style.
Definition theme.cpp:62
bool isBold(TextStyle style) const
Returns whether the given style should be shown in bold.
Definition theme.cpp:82
QRgb selectedTextColor(TextStyle style) const
Returns the selected text color to be used for style.
Definition theme.cpp:67
QRgb selectedBackgroundColor(TextStyle style) const
Returns the background color to be used for selected text for style.
Definition theme.cpp:77
bool isUnderline(TextStyle style) const
Returns whether the given style should be shown underlined.
Definition theme.cpp:92
TextStyle
Default styles that can be referenced from syntax definition XML files.
Definition theme.h:75
@ Normal
Default text style for normal text and source code without special highlighting.
Definition theme.h:78
bool isItalic(TextStyle style) const
Returns whether the given style should be shown in italic.
Definition theme.cpp:87
QRgb backgroundColor(TextStyle style) const
Returns the background color to be used for style.
Definition theme.cpp:72
KGuiItem ok()
Syntax highlighting engine for Kate syntax definitions.
Definition abstracthighlighter.h:17
const char * constData() const const
QColor fromRgb(QRgb rgb)
QColor fromRgba(QRgb rgba)
QRgb rgba() const const
QMetaEnum fromType()
QStringView mid(qsizetype start, qsizetype length) const const
bool isEmpty() const const
bool startsWith(QChar ch) const const
QByteArray toLatin1() const const
QString toString() const const
QStringView value(QAnyStringView namespaceUri, QAnyStringView name) const const
QXmlStreamAttributes attributes() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:12 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:12 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.