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
 
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
 
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 27 of file format.h.

Constructor & Destructor Documentation

◆ Format() [1/2]

Format::Format ( )

Creates an empty/invalid format.

Definition at line 71 of file format.cpp.

◆ Format() [2/2]

Format::Format ( const Format & other)

Definition at line 76 of file format.cpp.

◆ ~Format()

Format::~Format ( )

Definition at line 81 of file format.cpp.

Member Function Documentation

◆ backgroundColor()

QColor Format::backgroundColor ( const Theme & theme) const

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

Definition at line 140 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 135 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 216 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 191 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 196 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 226 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 221 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 206 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 120 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 211 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 201 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 101 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 150 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 111 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 159 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 177 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 168 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 91 of file format.cpp.

◆ name()

QString Format::name ( ) const

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

Definition at line 96 of file format.cpp.

◆ operator=()

Format & Format::operator= ( const Format & other)

Definition at line 85 of file format.cpp.

◆ selectedBackgroundColor()

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

◆ selectedTextColor()

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

◆ spellCheck()

bool Format::spellCheck ( ) const

Returns whether characters with this format should be spell checked.

Definition at line 186 of file format.cpp.

◆ textColor()

QColor Format::textColor ( const Theme & theme) const

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

Definition at line 125 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 106 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-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.