Krita Source Code Documentation
Loading...
Searching...
No Matches
IMEDecorationInfo Struct Reference

Public Member Functions

void setDecorationFromQStyle (QTextCharFormat::UnderlineStyle s)
 
void setDecorationFromQTextCharFormat (QTextCharFormat format)
 

Public Attributes

KoSvgText::TextDecorations decor = KoSvgText::DecorationNone
 Which sides get decorated.
 
int length = 0
 The length from the attribute.
 
int start = -1
 The startPos from the attribute.
 
KoSvgText::TextDecorationStyle style = KoSvgText::Solid
 The style.
 
bool thick = false
 Whether the decoration needs to be doubled in size.
 

Detailed Description

Definition at line 44 of file SvgTextCursor.cpp.

Member Function Documentation

◆ setDecorationFromQStyle()

void IMEDecorationInfo::setDecorationFromQStyle ( QTextCharFormat::UnderlineStyle s)
inline

Definition at line 51 of file SvgTextCursor.cpp.

51 {
52 // whenever qt sets an underlinestyle it always sets the underline.
53 decor.setFlag(KoSvgText::DecorationUnderline, s != QTextCharFormat::NoUnderline);
54 if (s == QTextCharFormat::DotLine) {
56 } else if (s == QTextCharFormat::DashUnderline) {
58 } else if (s == QTextCharFormat::WaveUnderline) {
60 } else if (s == QTextCharFormat::SpellCheckUnderline) {
62#ifdef Q_OS_MACOS
64#endif
65 } else {
67 }
68 }
@ Solid
Draw a solid line.Ex: --—.
Definition KoSvgText.h:266
@ Dashed
Draw a dashed line. Ex: - - - - -.
Definition KoSvgText.h:269
@ Wavy
Draw a wavy line. We currently make a zigzag, ex: ^^^^^.
Definition KoSvgText.h:270
@ Dotted
Draw a dotted line. Ex: .....
Definition KoSvgText.h:268
@ DecorationUnderline
Definition KoSvgText.h:259
KoSvgText::TextDecorationStyle style
The style.
KoSvgText::TextDecorations decor
Which sides get decorated.

References KoSvgText::Dashed, decor, KoSvgText::DecorationUnderline, KoSvgText::Dotted, KoSvgText::Solid, style, and KoSvgText::Wavy.

◆ setDecorationFromQTextCharFormat()

void IMEDecorationInfo::setDecorationFromQTextCharFormat ( QTextCharFormat format)
inline

Because Qt doesn't have a concept of a thick or double underline at time of writing, most of Qt's QPA will set the background to a solid color instead. Sometimes the underline style is changed (as with IBus). We don't support setting the background right now, so instead we'll 'convert' it back to a thick solid underline.

Definition at line 70 of file SvgTextCursor.cpp.

70 {
71 if (format.hasProperty(QTextFormat::FontUnderline)) {
72 decor.setFlag(KoSvgText::DecorationUnderline, format.property(QTextFormat::FontUnderline).toBool());
73 }
74 if (format.hasProperty(QTextFormat::FontOverline)) {
75 decor.setFlag(KoSvgText::DecorationOverline, format.property(QTextFormat::FontOverline).toBool());
76 }
77 if (format.hasProperty(QTextFormat::FontStrikeOut)) {
78 decor.setFlag(KoSvgText::DecorationLineThrough, format.property(QTextFormat::FontStrikeOut).toBool());
79 }
80
81 if (format.hasProperty(QTextFormat::TextUnderlineStyle)) {
82 setDecorationFromQStyle(format.underlineStyle());
83 }
90 if (format.hasProperty(QTextFormat::BackgroundBrush)) {
91 thick = format.background().isOpaque();
92#ifdef Q_OS_LINUX
93 if (style == KoSvgText::Dashed) {
95 }
96#endif
97
98 }
100 // Ensure a underline is always set.
102 }
103 }
@ DecorationOverline
Definition KoSvgText.h:260
@ DecorationLineThrough
Definition KoSvgText.h:261
@ DecorationNone
Definition KoSvgText.h:258
void setDecorationFromQStyle(QTextCharFormat::UnderlineStyle s)
bool thick
Whether the decoration needs to be doubled in size.

References KoSvgText::Dashed, decor, KoSvgText::DecorationLineThrough, KoSvgText::DecorationNone, KoSvgText::DecorationOverline, KoSvgText::DecorationUnderline, setDecorationFromQStyle(), KoSvgText::Solid, style, and thick.

Member Data Documentation

◆ decor

KoSvgText::TextDecorations IMEDecorationInfo::decor = KoSvgText::DecorationNone

Which sides get decorated.

Definition at line 47 of file SvgTextCursor.cpp.

◆ length

int IMEDecorationInfo::length = 0

The length from the attribute.

Definition at line 46 of file SvgTextCursor.cpp.

◆ start

int IMEDecorationInfo::start = -1

The startPos from the attribute.

Definition at line 45 of file SvgTextCursor.cpp.

◆ style

The style.

Definition at line 48 of file SvgTextCursor.cpp.

◆ thick

bool IMEDecorationInfo::thick = false

Whether the decoration needs to be doubled in size.

Definition at line 49 of file SvgTextCursor.cpp.


The documentation for this struct was generated from the following file: