Qt 4.8
|
The QTextLength class encapsulates the different types of length used in a QTextDocument. More...
#include <qtextformat.h>
Public Types | |
enum | Type { VariableLength = 0, FixedLength, PercentageLength } |
This enum describes the different types a length object can have. More... | |
Public Functions | |
operator QVariant () const | |
Returns the text length as a QVariant. More... | |
bool | operator!= (const QTextLength &other) const |
Returns true if this text length is different from the other text length. More... | |
bool | operator== (const QTextLength &other) const |
Returns true if this text length is the same as the other text length. More... | |
QTextLength () | |
Constructs a new length object which represents a variable size. More... | |
QTextLength (Type type, qreal value) | |
Constructs a new length object of the given type and value. More... | |
qreal | rawValue () const |
Returns the constraint value that is specific for the type of the length. More... | |
Type | type () const |
Returns the type of this length object. More... | |
qreal | value (qreal maximumLength) const |
Returns the effective length, constrained by the type of the length object and the specified maximumLength. More... | |
Properties | |
qreal | fixedValueOrPercentage |
Type | lengthType |
Friends | |
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QTextLength &) |
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QTextLength &) |
The QTextLength class encapsulates the different types of length used in a QTextDocument.
When we specify a value for the length of an element in a text document, we often need to provide some other information so that the length is used in the way we expect. For example, when we specify a table width, the value can represent a fixed number of pixels, or it can be a percentage value. This information changes both the meaning of the value and the way it is used.
Generally, this class is used to specify table widths. These can be specified either as a fixed amount of pixels, as a percentage of the containing frame's width, or by a variable width that allows it to take up just the space it requires.
Definition at line 84 of file qtextformat.h.
enum QTextLength::Type |
This enum describes the different types a length object can have.
Enumerator | |
---|---|
VariableLength | |
FixedLength | |
PercentageLength |
Definition at line 87 of file qtextformat.h.
|
inlineexplicit |
Constructs a new length object which represents a variable size.
Definition at line 89 of file qtextformat.h.
Referenced by QTextFrameFormat::setHeight(), and QTextFrameFormat::setWidth().
Constructs a new length object of the given type and value.
Definition at line 121 of file qtextformat.h.
QTextLength::operator QVariant | ( | ) | const |
Returns the text length as a QVariant.
Definition at line 173 of file qtextformat.cpp.
|
inline |
Returns true if this text length is different from the other text length.
Definition at line 109 of file qtextformat.h.
|
inline |
Returns true if this text length is the same as the other text length.
Definition at line 106 of file qtextformat.h.
Referenced by QTextFormat::isTableCellFormat(), and QTextFormat::operator!=().
|
inline |
Returns the constraint value that is specific for the type of the length.
If the length is QTextLength::PercentageLength then the raw value is in percent, in the range of 0 to 100. If the length is QTextLength::FixedLength then that fixed amount is returned. For variable lengths, zero is returned.
Definition at line 104 of file qtextformat.h.
Referenced by QTextHtmlExporter::emitTextLength(), and QTextDocumentLayoutPrivate::layoutTable().
|
inline |
Returns the type of this length object.
Definition at line 93 of file qtextformat.h.
Referenced by QTextHtmlExporter::emitBlock(), QTextHtmlExporter::emitTextLength(), QTextFormat::isBlockFormat(), QTextFormat::isCharFormat(), QTextFormat::isFrameFormat(), QTextFormat::isImageFormat(), QTextFormat::isListFormat(), QTextFormat::isTableCellFormat(), QTextFormat::isTableFormat(), QTextFormat::isValid(), QTextDocumentLayoutPrivate::layoutFrame(), QTextDocumentLayoutPrivate::layoutTable(), and QTextHtmlImporter::scanTable().
Returns the effective length, constrained by the type of the length object and the specified maximumLength.
Definition at line 94 of file qtextformat.h.
Referenced by QTextDocumentLayoutPrivate::drawBlock(), QTextFormat::isValid(), QTextDocumentLayoutPrivate::layoutFrame(), and QTextHtmlImporter::scanTable().
|
friend |
|
friend |
Definition at line 184 of file qtextformat.cpp.
Referenced by QTextLength().
|
private |
Definition at line 116 of file qtextformat.h.
Referenced by operator!=(), operator<<(), operator==(), and operator>>().
|
private |
Definition at line 115 of file qtextformat.h.
Referenced by operator!=(), operator<<(), operator==(), and operator>>().