KSyntaxHighlighting
format.cpp
49 QColor FormatPrivate::color(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const
56 return QColor::fromRgba(style.*styleColor ? style.*styleColor : (theme.*themeColor)(defaultStyle));
59 bool 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);
QString name() const
The name of this format as used in the syntax definition file.
Definition: format.cpp:96
QByteArray toLatin1() const const
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
QStringRef value(const QString &namespaceUri, const QString &name) const const
bool hasStrikeThroughOverride() const
Returns true if the syntax definition file specifies a value for the struck through text attribute.
Definition: format.cpp:206
bool hasUnderlineOverride() const
Returns true if the syntax definition file sets a value for the underlined text attribute and,...
Definition: format.cpp:201
QStringView mid(qsizetype start) const const
Describes the format to be used for a specific text fragment.
Definition: format.h:33
bool hasBoldOverride() const
Returns true if the syntax definition file sets a value for the bold text attribute and,...
Definition: format.cpp:191
TextStyle
Default styles that can be referenced from syntax definition XML files.
Definition: theme.h:80
QColor fromRgba(QRgb rgba)
QRgb backgroundColor(TextStyle style) const
Returns the background color to be used for style.
Definition: theme.cpp:72
bool isItalic(TextStyle style) const
Returns whether the given style should be shown in italic.
Definition: theme.cpp:87
bool isStrikeThrough(TextStyle style) const
Returns whether the given style should be shown struck through.
Definition: theme.cpp:97
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 spellCheck() const
Returns whether characters with this format should be spell checked.
Definition: format.cpp:186
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
QColor textColor(const Theme &theme) const
Returns the foreground color of the combination of this format and the given theme.
Definition: format.cpp:125
Definition: abstracthighlighter.h:20
bool isBold(TextStyle style) const
Returns whether the given style should be shown in bold.
Definition: theme.cpp:82
QXmlStreamAttributes attributes() const const
QColor backgroundColor(const Theme &theme) const
Returns the background color of the combination of this format and the given theme.
Definition: format.cpp:140
QColor fromRgb(QRgb rgb)
QRgb selectedBackgroundColor(TextStyle style) const
Returns the background color to be used for selected text for style.
Definition: theme.cpp:77
bool hasBackgroundColorOverride() const
Returns true if the syntax definition file sets a value for the background color attribute and,...
Definition: format.cpp:216
QRgb selectedTextColor(TextStyle style) const
Returns the selected text color to be used for style.
Definition: theme.cpp:67
bool isUnderline(TextStyle style) const
Returns whether the given style should be shown underlined.
Definition: theme.cpp:92
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
bool isEmpty() const const
bool hasTextColorOverride() const
Returns true if the syntax definition file sets a value for the foreground text color attribute and,...
Definition: format.cpp:211
Theme::TextStyle textStyle() const
Returns the underlying TextStyle of this Format.
Definition: format.cpp:106
QString toString() const const
const char * constData() const const
@ Normal
Default text style for normal text and source code without special highlighting.
Definition: theme.h:83
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 hasSelectedTextColorOverride() const
Returns true if the syntax definition file specifies a value for the selected text color attribute.
Definition: format.cpp:221
KGuiItem ok()
bool hasSelectedBackgroundColorOverride() const
Returns true if the syntax definition file specifies a value for the selected background color attrib...
Definition: format.cpp:226
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
QRgb textColor(TextStyle style) const
Returns the text color to be used for style.
Definition: theme.cpp:62
bool startsWith(QStringView str, Qt::CaseSensitivity cs) const const
QRgb rgba() const const
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 hasItalicOverride() const
Returns true if the syntax definition file sets a value for the italic text attribute and,...
Definition: format.cpp:196
virtual QVariant get(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName)
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:01:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:01:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.