Public Types | Public Member Functions | Friends

QTextLength Class Reference

Search for all occurrences

Detailed Description

Definition at line 84 of file qtextformat.h.

#include <qtextformat.h>

List of all members.

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 QDataStream operator<< (QDataStream &, const QTextLength &)
Q_GUI_EXPORT QDataStream operator>> (QDataStream &, QTextLength &)

Member Enumeration Documentation

enum Type

Constructor & Destructor Documentation

QTextLength ( ) [inline]

Definition at line 89 of file qtextformat.h.

: lengthType(VariableLength), fixedValueOrPercentage(0) {}
QTextLength ( Type  type,
qreal  value 
) [inline, explicit]

Definition at line 121 of file qtextformat.h.

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

Member Function Documentation

Type type ( ) const [inline]

Definition at line 93 of file qtextformat.h.

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

Definition at line 94 of file qtextformat.h.

    {
        switch (lengthType) {
            case FixedLength: return fixedValueOrPercentage;
            case VariableLength: return maximumLength;
            case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100);
        }
        return -1;
    }
qreal rawValue ( ) const [inline]

Definition at line 104 of file qtextformat.h.

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

Definition at line 106 of file qtextformat.h.

    { return lengthType == other.lengthType
             && qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
bool operator!= ( const QTextLength other ) const [inline]

Definition at line 109 of file qtextformat.h.

    { return lengthType != other.lengthType
             || !qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
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:

QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength
QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength QTextLength