KSyntaxHighlighting::Format

Search for usage in LXR

KSyntaxHighlighting::Format Class Reference

#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
 
quint16 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
 
Formatoperator= (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

Definition at line 33 of file format.h.

Constructor & Destructor Documentation

Format::Format ( )

Creates an empty/invalid format.

Definition at line 58 of file format.cpp.

Member Function Documentation

QColor Format::backgroundColor ( const Theme theme) const

Returns the background color of the combination of this format and the given theme.

Definition at line 136 of file format.cpp.

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 129 of file format.cpp.

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 219 of file format.cpp.

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 194 of file format.cpp.

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 199 of file format.cpp.

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 229 of file format.cpp.

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 224 of file format.cpp.

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 209 of file format.cpp.

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 107 of file format.cpp.

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 214 of file format.cpp.

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 204 of file format.cpp.

quint16 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 88 of file format.cpp.

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 157 of file format.cpp.

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 98 of file format.cpp.

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 165 of file format.cpp.

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 181 of file format.cpp.

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 173 of file format.cpp.

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 78 of file format.cpp.

QString Format::name ( ) const

The name of this format as used in the syntax definition file.

Definition at line 83 of file format.cpp.

QColor Format::selectedBackgroundColor ( const Theme theme) const

Returns the background color of selected text of the combination of this format and the given theme.

Definition at line 146 of file format.cpp.

QColor Format::selectedTextColor ( const Theme theme) const

Returns the foreground color for selected text of the combination of this format and the given theme.

Definition at line 121 of file format.cpp.

bool Format::spellCheck ( ) const

Returns whether characters with this format should be spell checked.

Definition at line 189 of file format.cpp.

QColor Format::textColor ( const Theme theme) const

Returns the foreground color of the combination of this format and the given theme.

Definition at line 113 of file format.cpp.

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 93 of file format.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Jun 20 2021 22:58:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.