ZTextOption¶
-
class Tui::ZTextOption¶
This class is copyable. It does define comparison operators for equality.
This class contains options for use with
Tui::ZTextLayout
.Enums
-
using Flags = QFlags<Tui::ZTextOption::Flag>¶
-
enum Flag¶
-
enumerator ShowTabsAndSpaces¶
Display tabs and spaces using characters
→
and·
respectivly.Additionally the application can select a text style different from normal text to display these characters.
-
enumerator ShowTabsAndSpacesWithColors¶
Display tabs and trailing spaces using special colors.
The choice of colors is done either by setting fixed colors in ZTextOption for these or by setting color mapping functions that return the used color based on the text style of the normal text.
-
enumerator ShowTabsAndSpaces¶
-
enum WrapMode¶
-
enumerator NoWrap¶
Do not wrap lines.
-
enumerator WordWrap¶
Wrap lines between words.
-
enumerator WrapAnywhere¶
Wrap lines anywhere, even breaking words apart.
-
enumerator NoWrap¶
Types
-
class Tab¶
Describes a tab stop.
-
Tab(int pos, Tui::ZTextOption::TabType tabType)¶
Sets the position of the tab stop to
pos
and the type of the tab stop totabType
.
-
int position = 0¶
The position of the tab stop in cells.
-
Tui::ZTextOption::TabType type = LeftTab¶
The type of the tab stop.
Currently only left aligned tabs are supported.
-
Tab(int pos, Tui::ZTextOption::TabType tabType)¶
Functions
-
Tui::ZTextOption::Flags flags() const¶
-
void setFlags(Tui::ZTextOption::Flags flags)¶
See
Tui::ZTextOption::Flags
for possible flag values.
-
int tabStopDistance() const¶
-
void setTabStopDistance(int tabStopDistance)¶
Definies tab positions beyond tabs explicitly specified using
setTabs
orsetTabArray
.Tab stops definied by this are only active after the last individually placed tab stop and are in columns
i * tabStopDistance
(for i > 0).Values of
tabStopDistance
less than 1 are invalid and replaced by the value 1.Defaults to 8.
-
QList<Tui::ZTextOption::Tab> tabs() const¶
-
void setTabs(const QList<Tui::ZTextOption::Tab> &tabStops)¶
Set explicit tab stops
tabStops
.On return the tab stops are always sorted.
-
void setTabArray(const QList<int> &tabStops)¶
Set explicit left aligned tab stops at the columns in
tabStops
.On return the tab stops are always sorted.
-
void setWrapMode(WrapMode mode)¶
Selects which line wrapping mode is used.
See
Tui::ZTextOption::WrapMode
for possible values.
-
void setTrailingWhitespaceColor(std::function<Tui::ZTextStyle(const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange*)> colorMapper)¶
Sets the function used in
mapTrailingWhitespaceColor
-
Tui::ZTextStyle mapTrailingWhitespaceColor(const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange *range) const¶
Apply the mapping function set by
setTrailingWhitespaceColor
.If the mapping function was not yet set returns range ? range->format() : formatingChars.
-
void setTabColor(std::function<Tui::ZTextStyle(int pos, int size, int hidden, const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange*)> colorMapper)¶
Sets the function used in
mapTabColor
-
Tui::ZTextStyle mapTabColor(int pos, int size, int hidden, const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange *range) const¶
Apply the mapping function set by
setTabColor
.If the mapping function was not yet set returns range ? range->format() : formatingChars.
-
using Flags = QFlags<Tui::ZTextOption::Flag>¶