<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/gui/text/qtextformat.cpp --> <head> <title>Qt 4.2: QTextLength Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QTextLength Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1> <p>The QTextLength class encapsulates the different types of length used in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p> <pre> #include <QTextLength></pre><ul> <li><a href="qtextlength-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h3>Public Types</h3> <ul> <li><div class="fn"/>enum <b><a href="qtextlength.html#Type-enum">Type</a></b> { VariableLength, FixedLength, PercentageLength }</li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"/><b><a href="qtextlength.html#QTextLength">QTextLength</a></b> ()</li> <li><div class="fn"/><b><a href="qtextlength.html#QTextLength-2">QTextLength</a></b> ( Type <i>type</i>, qreal <i>value</i> )</li> <li><div class="fn"/>qreal <b><a href="qtextlength.html#rawValue">rawValue</a></b> () const</li> <li><div class="fn"/>Type <b><a href="qtextlength.html#type">type</a></b> () const</li> <li><div class="fn"/>qreal <b><a href="qtextlength.html#value">value</a></b> ( qreal <i>maximumLength</i> ) const</li> <li><div class="fn"/><b><a href="qtextlength.html#operator-QVariant">operator QVariant</a></b> () const</li> <li><div class="fn"/>bool <b><a href="qtextlength.html#operator-not-eq">operator!=</a></b> ( const QTextLength & <i>other</i> ) const</li> <li><div class="fn"/>bool <b><a href="qtextlength.html#operator-eq-eq">operator==</a></b> ( const QTextLength & <i>other</i> ) const</li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QTextLength class encapsulates the different types of length used in a <a href="qtextdocument.html">QTextDocument</a>.</p> <p>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.</p> <p>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.</p> <p>See also <a href="qtexttable.html">QTextTable</a>.</p> <hr /> <h2>Member Type Documentation</h2> <h3 class="fn"><a name="Type-enum"></a>enum QTextLength::Type</h3> <p><table border="1" cellpadding="2" cellspacing="1" width="40%"> <tr><th width="60%">Constant</th><th width="40%">Value</th></tr> <tr><td valign="top"><tt>QTextLength::VariableLength</tt></td><td align="center" valign="top"><tt>0</tt></td></tr> <tr><td valign="top"><tt>QTextLength::FixedLength</tt></td><td align="center" valign="top"><tt>1</tt></td></tr> <tr><td valign="top"><tt>QTextLength::PercentageLength</tt></td><td align="center" valign="top"><tt>2</tt></td></tr> </table></p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QTextLength"></a>QTextLength::QTextLength ()</h3> <p>Constructs a new length object which represents a variable size.</p> <h3 class="fn"><a name="QTextLength-2"></a>QTextLength::QTextLength ( <a href="qtextlength.html#Type-enum">Type</a> <i>type</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>value</i> )</h3> <p>Constructs a new length object of the given <i>type</i> and <i>value</i>.</p> <h3 class="fn"><a name="rawValue"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLength::rawValue () const</h3> <p>Returns the constraint value that is specific for the type of the lenght. If the length is QTextLength::PercentageLengt then the raw value is in percent, in the range of 0 to 100. If the length is <a href="qtextlength.html#Type-enum">QTextLength::FixedLength</a> then that fixed amount is returned. For variable lengths zero is returned.</p> <h3 class="fn"><a name="type"></a><a href="qtextlength.html#Type-enum">Type</a> QTextLength::type () const</h3> <p>Returns the type of length.</p> <p>See also <a href="qtextlength.html#Type-enum">QTextLength::Type</a>.</p> <h3 class="fn"><a name="value"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextLength::value ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>maximumLength</i> ) const</h3> <p>Returns the effective length, constrained by the type of the length object and the specified <i>maximumLength</i>.</p> <p>See also <a href="qtextlength.html#type">type</a>().</p> <h3 class="fn"><a name="operator-QVariant"></a>QTextLength::operator QVariant () const</h3> <p>Returns the text length as a <a href="qvariant.html">QVariant</a></p> <h3 class="fn"><a name="operator-not-eq"></a>bool QTextLength::operator!= ( const QTextLength & <i>other</i> ) const</h3> <p>Returns true if this text length is different from the <i>other</i> text length.</p> <h3 class="fn"><a name="operator-eq-eq"></a>bool QTextLength::operator== ( const QTextLength & <i>other</i> ) const</h3> <p>Returns true if this text length is the same as the <i>other</i> text length.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>