6#ifndef QSK_TEXT_OPTIONS_H
7#define QSK_TEXT_OPTIONS_H
12#include <qtextoption.h>
20 Q_PROPERTY( TextFormat format READ format WRITE setFormat )
21 Q_PROPERTY( Qt::TextElideMode elideMode READ elideMode WRITE setElideMode )
22 Q_PROPERTY( WrapMode wrapMode READ wrapMode WRITE setWrapMode )
23 Q_PROPERTY( FontSizeMode fontSizeMode READ fontSizeMode WRITE setFontSizeMode )
24 Q_PROPERTY(
int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount )
34 Q_ENUM( FontSizeMode )
38 NoWrap = QTextOption::NoWrap,
39 WordWrap = QTextOption::WordWrap,
40 WrapAnywhere = QTextOption::WrapAnywhere,
41 Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere
47 PlainText = Qt::PlainText,
48 RichText = Qt::RichText,
49 AutoText = Qt::AutoText,
56 constexpr TextFormat format()
const noexcept;
57 void setFormat( TextFormat )
noexcept;
59 TextFormat effectiveFormat(
const QString& text )
const;
61 constexpr Qt::TextElideMode elideMode()
const noexcept;
62 void setElideMode( Qt::TextElideMode )
noexcept;
64 constexpr Qt::TextElideMode effectiveElideMode()
const noexcept;
66 constexpr FontSizeMode fontSizeMode()
const noexcept;
67 void setFontSizeMode( FontSizeMode )
noexcept;
69 constexpr WrapMode wrapMode()
const noexcept;
70 void setWrapMode( WrapMode )
noexcept;
72 constexpr int maximumLineCount()
const noexcept;
73 void setMaximumLineCount(
int )
noexcept;
75 constexpr bool operator==(
const QskTextOptions& other )
const noexcept;
76 constexpr bool operator!=(
const QskTextOptions& other )
const noexcept;
78 QskHashValue hash( QskHashValue seed )
const noexcept;
80 int textFlags()
const noexcept;
83 int m_maximumLineCount;
84 FontSizeMode m_fontSizeMode : 2;
85 WrapMode m_wrapMode : 4;
86 TextFormat m_format : 3;
87 Qt::TextElideMode m_elideMode : 2;
90inline constexpr QskTextOptions::QskTextOptions() noexcept
91 : m_maximumLineCount( std::numeric_limits<
int >::max() )
94 , m_format( PlainText )
95 , m_elideMode( Qt::ElideNone )
99inline void QskTextOptions::setFormat( TextFormat format )
noexcept
104constexpr inline QskTextOptions::TextFormat QskTextOptions::format() const noexcept
109inline void QskTextOptions::setElideMode( Qt::TextElideMode elideMode )
noexcept
111 m_elideMode = elideMode;
114constexpr inline Qt::TextElideMode QskTextOptions::elideMode() const noexcept
119constexpr inline Qt::TextElideMode QskTextOptions::effectiveElideMode() const noexcept
121 return ( m_wrapMode != QskTextOptions::NoWrap ) ? Qt::ElideNone : m_elideMode;
124inline void QskTextOptions::setWrapMode( WrapMode wrapMode )
noexcept
126 m_wrapMode = wrapMode;
129constexpr inline QskTextOptions::WrapMode QskTextOptions::wrapMode() const noexcept
134inline void QskTextOptions::setFontSizeMode( FontSizeMode fontSizeMode )
noexcept
136 m_fontSizeMode = fontSizeMode;
139constexpr inline QskTextOptions::FontSizeMode QskTextOptions::fontSizeMode() const noexcept
141 return m_fontSizeMode;
144inline void QskTextOptions::setMaximumLineCount(
int lineCount )
noexcept
146 m_maximumLineCount = lineCount;
149constexpr inline int QskTextOptions::maximumLineCount() const noexcept
151 return m_maximumLineCount;
154inline constexpr bool QskTextOptions::operator==(
157 return ( m_format == other.m_format ) &&
158 ( m_elideMode == other.m_elideMode ) &&
159 ( m_wrapMode == other.m_wrapMode ) &&
160 ( m_fontSizeMode == other.m_fontSizeMode ) &&
161 ( m_maximumLineCount == other.m_maximumLineCount );
164inline constexpr bool QskTextOptions::operator!=(
167 return !( *
this == other );
170#ifndef QT_NO_DEBUG_STREAM