more C++11 specifier
This commit is contained in:
parent
acbfb9a006
commit
475a5a7dc1
@ -5,76 +5,8 @@
|
||||
|
||||
#include "QskTextOptions.h"
|
||||
#include <qtextdocument.h>
|
||||
#include <limits>
|
||||
|
||||
QskTextOptions::QskTextOptions()
|
||||
: m_maximumLineCount( std::numeric_limits< int >::max() )
|
||||
, m_fontSizeMode( QskTextOptions::FixedSize )
|
||||
, m_wrapMode( QskTextOptions::NoWrap )
|
||||
, m_format( PlainText ) // AutoText ???
|
||||
, m_elideMode( Qt::ElideNone )
|
||||
{
|
||||
}
|
||||
|
||||
void QskTextOptions::setFormat( TextFormat format )
|
||||
{
|
||||
m_format = format;
|
||||
}
|
||||
|
||||
QskTextOptions::TextFormat QskTextOptions::format() const
|
||||
{
|
||||
return m_format;
|
||||
}
|
||||
|
||||
void QskTextOptions::setElideMode( Qt::TextElideMode elideMode )
|
||||
{
|
||||
m_elideMode = elideMode;
|
||||
}
|
||||
|
||||
Qt::TextElideMode QskTextOptions::elideMode() const
|
||||
{
|
||||
return m_elideMode;
|
||||
}
|
||||
|
||||
Qt::TextElideMode QskTextOptions::effectiveElideMode() const
|
||||
{
|
||||
if ( m_wrapMode != QskTextOptions::NoWrap )
|
||||
return Qt::ElideNone;
|
||||
|
||||
return m_elideMode;
|
||||
}
|
||||
|
||||
void QskTextOptions::setWrapMode( WrapMode wrapMode )
|
||||
{
|
||||
m_wrapMode = wrapMode;
|
||||
}
|
||||
|
||||
QskTextOptions::WrapMode QskTextOptions::wrapMode() const
|
||||
{
|
||||
return m_wrapMode;
|
||||
}
|
||||
|
||||
void QskTextOptions::setFontSizeMode( FontSizeMode fontSizeMode )
|
||||
{
|
||||
m_fontSizeMode = fontSizeMode;
|
||||
}
|
||||
|
||||
QskTextOptions::FontSizeMode QskTextOptions::fontSizeMode() const
|
||||
{
|
||||
return m_fontSizeMode;
|
||||
}
|
||||
|
||||
void QskTextOptions::setMaximumLineCount( int lineCount )
|
||||
{
|
||||
m_maximumLineCount = lineCount;
|
||||
}
|
||||
|
||||
int QskTextOptions::maximumLineCount() const
|
||||
{
|
||||
return m_maximumLineCount;
|
||||
}
|
||||
|
||||
int QskTextOptions::textFlags() const
|
||||
int QskTextOptions::textFlags() const noexcept
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
@ -107,15 +39,6 @@ int QskTextOptions::textFlags() const
|
||||
return flags;
|
||||
}
|
||||
|
||||
bool QskTextOptions::operator==( const QskTextOptions& other ) const
|
||||
{
|
||||
return ( m_format == other.m_format ) &&
|
||||
( m_elideMode == other.m_elideMode ) &&
|
||||
( m_wrapMode == other.m_wrapMode ) &&
|
||||
( m_fontSizeMode == other.m_fontSizeMode ) &&
|
||||
( m_maximumLineCount == other.m_maximumLineCount );
|
||||
}
|
||||
|
||||
QskTextOptions::TextFormat QskTextOptions::effectiveFormat( const QString& text ) const
|
||||
{
|
||||
if ( text.isEmpty() )
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <qmetatype.h>
|
||||
#include <qtextoption.h>
|
||||
|
||||
class QDebug;
|
||||
#include <limits>
|
||||
|
||||
class QSK_EXPORT QskTextOptions
|
||||
{
|
||||
@ -41,8 +41,6 @@ class QSK_EXPORT QskTextOptions
|
||||
};
|
||||
Q_ENUM( WrapMode )
|
||||
|
||||
QskTextOptions();
|
||||
|
||||
enum TextFormat
|
||||
{
|
||||
PlainText = Qt::PlainText,
|
||||
@ -52,29 +50,31 @@ class QSK_EXPORT QskTextOptions
|
||||
};
|
||||
Q_ENUM( TextFormat )
|
||||
|
||||
TextFormat format() const;
|
||||
void setFormat( TextFormat );
|
||||
constexpr QskTextOptions() noexcept;
|
||||
|
||||
constexpr TextFormat format() const noexcept;
|
||||
void setFormat( TextFormat ) noexcept;
|
||||
|
||||
TextFormat effectiveFormat( const QString& text ) const;
|
||||
|
||||
Qt::TextElideMode elideMode() const;
|
||||
void setElideMode( Qt::TextElideMode );
|
||||
constexpr Qt::TextElideMode elideMode() const noexcept;
|
||||
void setElideMode( Qt::TextElideMode ) noexcept;
|
||||
|
||||
Qt::TextElideMode effectiveElideMode() const;
|
||||
constexpr Qt::TextElideMode effectiveElideMode() const noexcept;
|
||||
|
||||
FontSizeMode fontSizeMode() const;
|
||||
void setFontSizeMode( FontSizeMode );
|
||||
constexpr FontSizeMode fontSizeMode() const noexcept;
|
||||
void setFontSizeMode( FontSizeMode ) noexcept;
|
||||
|
||||
WrapMode wrapMode() const;
|
||||
void setWrapMode( WrapMode );
|
||||
constexpr WrapMode wrapMode() const noexcept;
|
||||
void setWrapMode( WrapMode ) noexcept;
|
||||
|
||||
int maximumLineCount() const;
|
||||
void setMaximumLineCount( int );
|
||||
constexpr int maximumLineCount() const noexcept;
|
||||
void setMaximumLineCount( int ) noexcept;
|
||||
|
||||
bool operator==( const QskTextOptions& other ) const;
|
||||
bool operator!=( const QskTextOptions& other ) const;
|
||||
constexpr bool operator==( const QskTextOptions& other ) const noexcept;
|
||||
constexpr bool operator!=( const QskTextOptions& other ) const noexcept;
|
||||
|
||||
int textFlags() const;
|
||||
int textFlags() const noexcept;
|
||||
|
||||
private:
|
||||
int m_maximumLineCount;
|
||||
@ -84,7 +84,82 @@ class QSK_EXPORT QskTextOptions
|
||||
Qt::TextElideMode m_elideMode : 2;
|
||||
};
|
||||
|
||||
inline bool QskTextOptions::operator!=( const QskTextOptions& other ) const
|
||||
inline constexpr QskTextOptions::QskTextOptions() noexcept
|
||||
: m_maximumLineCount( std::numeric_limits< int >::max() )
|
||||
, m_fontSizeMode( QskTextOptions::FixedSize )
|
||||
, m_wrapMode( QskTextOptions::NoWrap )
|
||||
, m_format( PlainText ) // AutoText ???
|
||||
, m_elideMode( Qt::ElideNone )
|
||||
{
|
||||
}
|
||||
|
||||
inline void QskTextOptions::setFormat( TextFormat format ) noexcept
|
||||
{
|
||||
m_format = format;
|
||||
}
|
||||
|
||||
constexpr inline QskTextOptions::TextFormat QskTextOptions::format() const noexcept
|
||||
{
|
||||
return m_format;
|
||||
}
|
||||
|
||||
inline void QskTextOptions::setElideMode( Qt::TextElideMode elideMode ) noexcept
|
||||
{
|
||||
m_elideMode = elideMode;
|
||||
}
|
||||
|
||||
constexpr inline Qt::TextElideMode QskTextOptions::elideMode() const noexcept
|
||||
{
|
||||
return m_elideMode;
|
||||
}
|
||||
|
||||
constexpr inline Qt::TextElideMode QskTextOptions::effectiveElideMode() const noexcept
|
||||
{
|
||||
return ( m_wrapMode != QskTextOptions::NoWrap ) ? Qt::ElideNone : m_elideMode;
|
||||
}
|
||||
|
||||
inline void QskTextOptions::setWrapMode( WrapMode wrapMode ) noexcept
|
||||
{
|
||||
m_wrapMode = wrapMode;
|
||||
}
|
||||
|
||||
constexpr inline QskTextOptions::WrapMode QskTextOptions::wrapMode() const noexcept
|
||||
{
|
||||
return m_wrapMode;
|
||||
}
|
||||
|
||||
inline void QskTextOptions::setFontSizeMode( FontSizeMode fontSizeMode ) noexcept
|
||||
{
|
||||
m_fontSizeMode = fontSizeMode;
|
||||
}
|
||||
|
||||
constexpr inline QskTextOptions::FontSizeMode QskTextOptions::fontSizeMode() const noexcept
|
||||
{
|
||||
return m_fontSizeMode;
|
||||
}
|
||||
|
||||
inline void QskTextOptions::setMaximumLineCount( int lineCount ) noexcept
|
||||
{
|
||||
m_maximumLineCount = lineCount;
|
||||
}
|
||||
|
||||
constexpr inline int QskTextOptions::maximumLineCount() const noexcept
|
||||
{
|
||||
return m_maximumLineCount;
|
||||
}
|
||||
|
||||
inline constexpr bool QskTextOptions::operator==(
|
||||
const QskTextOptions& other ) const noexcept
|
||||
{
|
||||
return ( m_format == other.m_format ) &&
|
||||
( m_elideMode == other.m_elideMode ) &&
|
||||
( m_wrapMode == other.m_wrapMode ) &&
|
||||
( m_fontSizeMode == other.m_fontSizeMode ) &&
|
||||
( m_maximumLineCount == other.m_maximumLineCount );
|
||||
}
|
||||
|
||||
inline constexpr bool QskTextOptions::operator!=(
|
||||
const QskTextOptions& other ) const noexcept
|
||||
{
|
||||
return !( *this == other );
|
||||
}
|
||||
@ -92,6 +167,8 @@ inline bool QskTextOptions::operator!=( const QskTextOptions& other ) const
|
||||
QSK_EXPORT uint qHash( const QskTextOptions&, uint seed = 0 ) noexcept;
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
class QDebug;
|
||||
|
||||
QSK_EXPORT QDebug operator<<( QDebug, const QskTextOptions& );
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user