![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\reentrant 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 Member Functions | |
QTextLength () | |
Constructs a new length object which represents a variable size. | |
QTextLength (Type type, qreal value) | |
Constructs a new length object of the given type and value. | |
Type | type () const |
Returns the type of this length object. | |
qreal | value (qreal maximumLength) const |
Returns the effective length, constrained by the type of the length object and the specified maximumLength. | |
qreal | rawValue () const |
Returns the constraint value that is specific for the type of the length. | |
bool | operator== (const QTextLength &other) const |
Returns true if this text length is the same as the other text length. | |
bool | operator!= (const QTextLength &other) const |
Returns true if this text length is different from the other text length. | |
operator QVariant () const | |
Returns the text length as a QVariant. | |
Friends | |
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &stream, const QTextLength &length) |
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &stream, QTextLength &length) |
\reentrant
The QTextLength class encapsulates the different types of length used in a QTextDocument. \inmodule QtGui
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 44 of file qtextformat.h.
enum QTextLength::Type |
This enum describes the different types a length object can have.
\value VariableLength The width of the object is variable \value FixedLength The width of the object is fixed \value PercentageLength The width of the object is in percentage of the maximum width
Enumerator | |
---|---|
VariableLength | |
FixedLength | |
PercentageLength |
Definition at line 47 of file qtextformat.h.
|
inlineexplicit |
Constructs a new length object which represents a variable size.
Definition at line 49 of file qtextformat.h.
Constructs a new length object of the given type and value.
Definition at line 82 of file qtextformat.h.
QTextLength::operator QVariant | ( | ) | const |
Returns the text length as a QVariant.
Definition at line 109 of file qtextformat.cpp.
|
inline |
Returns true
if this text length is different from the other text length.
Definition at line 69 of file qtextformat.h.
|
inline |
Returns true
if this text length is the same as the other text length.
Definition at line 66 of file qtextformat.h.
|
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 64 of file qtextformat.h.
|
inline |
Returns the type of this length object.
Definition at line 53 of file qtextformat.h.
Returns the effective length, constrained by the type of the length object and the specified maximumLength.
Definition at line 54 of file qtextformat.h.
|
friend |
Definition at line 115 of file qtextformat.cpp.
|
friend |
Definition at line 120 of file qtextformat.cpp.