QTextLength Class Reference

QTextLength Class Reference

#include <qtextformat.h>

Class Description

Definition at line 84 of file qtextformat.h.

Public Types

enum  Type { VariableLength = 0, FixedLength, PercentageLength }
 

Public Member Functions

 QTextLength ()
 
 QTextLength (Type type, qreal value)
 
Type type () const
 
qreal value (qreal maximumLength) const
 
qreal rawValue () const
 
bool operator== (const QTextLength &other) const
 
bool operator!= (const QTextLength &other) const
 
 operator QVariant () const
 

Friends

Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QTextLength &)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QTextLength &)
 

Member Enumeration Documentation

enum Type
Enumerator
VariableLength 
FixedLength 
PercentageLength 

Definition at line 87 of file qtextformat.h.

Constructor & Destructor Documentation

QTextLength ( )
inline

Definition at line 89 of file qtextformat.h.

89 : lengthType(VariableLength), fixedValueOrPercentage(0) {}
QTextLength ( Type  type,
qreal  value 
)
inlineexplicit

Definition at line 121 of file qtextformat.h.

122  : lengthType(atype), fixedValueOrPercentage(avalue) {}

Member Function Documentation

Type type ( ) const
inline

Definition at line 93 of file qtextformat.h.

93 { return lengthType; }
qreal value ( qreal  maximumLength) const
inline

Definition at line 94 of file qtextformat.h.

95  {
96  switch (lengthType) {
97  case FixedLength: return fixedValueOrPercentage;
98  case VariableLength: return maximumLength;
99  case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100);
100  }
101  return -1;
102  }
qreal rawValue ( ) const
inline

Definition at line 104 of file qtextformat.h.

104 { return fixedValueOrPercentage; }
bool operator== ( const QTextLength other) const
inline

Definition at line 106 of file qtextformat.h.

107  { return lengthType == other.lengthType
108  && qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
Definition: qmatrix.h:172
bool operator!= ( const QTextLength other) const
inline

Definition at line 109 of file qtextformat.h.

110  { return lengthType != other.lengthType
111  || !qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
Definition: qmatrix.h:172
operator QVariant ( ) const

Friends And Related Function Documentation

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream ,
const QTextLength  
)
friend
Q_GUI_EXPORT QDataStream& operator>> ( QDataStream ,
QTextLength  
)
friend

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