KSyntaxHighlighting::Format
#include <format.h>
Public Member Functions | |
Format () | |
Format (const Format &other) | |
QColor | backgroundColor (const Theme &theme) const |
bool | hasBackgroundColor (const Theme &theme) const |
bool | hasBackgroundColorOverride () const |
bool | hasBoldOverride () const |
bool | hasItalicOverride () const |
bool | hasSelectedBackgroundColorOverride () const |
bool | hasSelectedTextColorOverride () const |
bool | hasStrikeThroughOverride () const |
bool | hasTextColor (const Theme &theme) const |
bool | hasTextColorOverride () const |
bool | hasUnderlineOverride () const |
int | id () const |
bool | isBold (const Theme &theme) const |
bool | isDefaultTextStyle (const Theme &theme) const |
bool | isItalic (const Theme &theme) const |
bool | isStrikeThrough (const Theme &theme) const |
bool | isUnderline (const Theme &theme) const |
bool | isValid () const |
QString | name () const |
Format & | operator= (const Format &other) |
QColor | selectedBackgroundColor (const Theme &theme) const |
QColor | selectedTextColor (const Theme &theme) const |
bool | spellCheck () const |
QColor | textColor (const Theme &theme) const |
Theme::TextStyle | textStyle () const |
Detailed Description
Describes the format to be used for a specific text fragment.
The actual format used for displaying is merged from the format information in the syntax definition file, and a theme.
- See also
- Theme
- Since
- 5.28
Constructor & Destructor Documentation
◆ Format() [1/2]
Format::Format | ( | ) |
Creates an empty/invalid format.
Definition at line 70 of file format.cpp.
◆ Format() [2/2]
Format::Format | ( | const Format & | other | ) |
Definition at line 75 of file format.cpp.
◆ ~Format()
Format::~Format | ( | ) |
Definition at line 80 of file format.cpp.
Member Function Documentation
◆ backgroundColor()
Returns the background color of the combination of this format and the given theme.
Definition at line 139 of file format.cpp.
◆ hasBackgroundColor()
bool Format::hasBackgroundColor | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the theme theme
change the background color compared to the default format.
Definition at line 134 of file format.cpp.
◆ hasBackgroundColorOverride()
bool Format::hasBackgroundColorOverride | ( | ) | const |
Returns true
if the syntax definition file sets a value for the background color attribute and, therefore, overrides the theme and the default formatting style.
If the return is true
, this value is obtained by backgroundColor().
- See also
- backgroundColor(), hasBackgroundColor()
- Since
- 5.62
Definition at line 215 of file format.cpp.
◆ hasBoldOverride()
bool Format::hasBoldOverride | ( | ) | const |
Returns true
if the syntax definition file sets a value for the bold text attribute and, therefore, overrides the theme and the default formatting style.
If the return is true
, this value is obtained by isBold().
- See also
- isBold()
- Since
- 5.62
Definition at line 190 of file format.cpp.
◆ hasItalicOverride()
bool Format::hasItalicOverride | ( | ) | const |
Returns true
if the syntax definition file sets a value for the italic text attribute and, therefore, overrides the theme and the default formatting style.
If the return is true
, this value is obtained by isItalic().
- See also
- isItalic()
- Since
- 5.62
Definition at line 195 of file format.cpp.
◆ hasSelectedBackgroundColorOverride()
bool Format::hasSelectedBackgroundColorOverride | ( | ) | const |
Returns true
if the syntax definition file specifies a value for the selected background color attribute.
If the return is true
, this value is obtained by selectedBackgroundColor().
- See also
- selectedBackgroundColor()
- Since
- 5.62
Definition at line 225 of file format.cpp.
◆ hasSelectedTextColorOverride()
bool Format::hasSelectedTextColorOverride | ( | ) | const |
Returns true
if the syntax definition file specifies a value for the selected text color attribute.
If the return is true
, this value is obtained by selectedTextColor().
- See also
- selectedTextColor()
- Since
- 5.62
Definition at line 220 of file format.cpp.
◆ hasStrikeThroughOverride()
bool Format::hasStrikeThroughOverride | ( | ) | const |
Returns true
if the syntax definition file specifies a value for the struck through text attribute.
If the return is true
, this value is obtained by isStrikeThrough().
- See also
- isStrikeThrough()
- Since
- 5.62
Definition at line 205 of file format.cpp.
◆ hasTextColor()
bool Format::hasTextColor | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the theme theme
change the foreground color compared to the default format.
Definition at line 119 of file format.cpp.
◆ hasTextColorOverride()
bool Format::hasTextColorOverride | ( | ) | const |
Returns true
if the syntax definition file sets a value for the foreground text color attribute and, therefore, overrides the theme and the default formatting style.
If the return is true
, this value is obtained by textColor().
- See also
- textColor(), hasTextColor()
- Since
- 5.62
Definition at line 210 of file format.cpp.
◆ hasUnderlineOverride()
bool Format::hasUnderlineOverride | ( | ) | const |
Returns true
if the syntax definition file sets a value for the underlined text attribute and, therefore, overrides the theme and the default formatting style.
If the return is true
, this value is obtained by isUnderline().
- See also
- isUnderline()
- Since
- 5.62
Definition at line 200 of file format.cpp.
◆ id()
int Format::id | ( | ) | const |
Returns a unique identifier of this format.
This is useful for efficient storing of formats in a text line. The identifier is unique per Repository instance, but will change when the repository is reloaded (which also invalidatess the corresponding Definition anyway).
Definition at line 100 of file format.cpp.
◆ isBold()
bool Format::isBold | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the given theme results in bold text formatting.
Definition at line 149 of file format.cpp.
◆ isDefaultTextStyle()
bool Format::isDefaultTextStyle | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the theme theme
do not change the default text format in any way.
This is useful for output formats where changing formatting implies cost, and thus benefit from optimizing the default case of not having any format applied. If you make use of this, make sure to set the default text style to what the corresponding theme sets for Theme::Normal.
Definition at line 110 of file format.cpp.
◆ isItalic()
bool Format::isItalic | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the given theme results in italic text formatting.
Definition at line 158 of file format.cpp.
◆ isStrikeThrough()
bool Format::isStrikeThrough | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the given theme results in struck through text.
Definition at line 176 of file format.cpp.
◆ isUnderline()
bool Format::isUnderline | ( | const Theme & | theme | ) | const |
Returns true
if the combination of this format and the given theme results in underlined text.
Definition at line 167 of file format.cpp.
◆ isValid()
bool Format::isValid | ( | ) | const |
Returns true
if this is a valid format, ie.
one that was read from a syntax definition file.
Definition at line 90 of file format.cpp.
◆ name()
QString Format::name | ( | ) | const |
The name of this format as used in the syntax definition file.
Definition at line 95 of file format.cpp.
◆ operator=()
Definition at line 84 of file format.cpp.
◆ selectedBackgroundColor()
Returns the background color of selected text of the combination of this format and the given theme.
Definition at line 144 of file format.cpp.
◆ selectedTextColor()
Returns the foreground color for selected text of the combination of this format and the given theme.
Definition at line 129 of file format.cpp.
◆ spellCheck()
bool Format::spellCheck | ( | ) | const |
Returns whether characters with this format should be spell checked.
Definition at line 185 of file format.cpp.
◆ textColor()
Returns the foreground color of the combination of this format and the given theme.
Definition at line 124 of file format.cpp.
◆ textStyle()
Theme::TextStyle Format::textStyle | ( | ) | const |
Returns the underlying TextStyle of this Format.
Every Theme::TextStyle is visually defined by a Theme. A Format uses one of the Theme::TextStyles and on top allows modifications such as setting a different foreground color etc.
- See also
- Theme::TextStyle
- Since
- 5.49
Definition at line 105 of file format.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.