<?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"> <!-- qtextformat.cpp --> <head> <title>Qt 4.6: QTextLength Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl//QTextLength"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" 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="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QTextLength Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span> </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><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p> <ul> <li><a href="qtextlength-members.html">List of all members, including inherited members</a></li> </ul> <hr /> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#Type-enum">Type</a></b> { VariableLength, FixedLength, PercentageLength }</td></tr> </table> <hr /> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#QTextLength">QTextLength</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#QTextLength-2">QTextLength</a></b> ( Type <i>type</i>, qreal <i>value</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">qreal </td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#rawValue">rawValue</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">Type </td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#type">type</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">qreal </td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#value">value</a></b> ( qreal <i>maximumLength</i> ) const</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#operator-QVariant">operator QVariant</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#operator-not-eq">operator!=</a></b> ( const QTextLength & <i>other</i> ) const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtextlength.html#operator-eq-eq">operator==</a></b> ( const QTextLength & <i>other</i> ) const</td></tr> </table> <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> <a name="//apple_ref/cpp/tag/QTextLength/Type"></a> <a name="//apple_ref/cpp/econst/QTextLength/VariableLength"></a> <a name="//apple_ref/cpp/econst/QTextLength/FixedLength"></a> <a name="//apple_ref/cpp/econst/QTextLength/PercentageLength"></a> <h3 class="fn"><a name="Type-enum"></a>enum QTextLength::Type</h3> <p>This enum describes the different types a length object can have.</p> <p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%"> <tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr> <tr><td valign="top"><tt>QTextLength::VariableLength</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The width of the object is variable</td></tr> <tr><td valign="top"><tt>QTextLength::FixedLength</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The width of the object is fixed</td></tr> <tr><td valign="top"><tt>QTextLength::PercentageLength</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The width of the object is in percentage of the maximum width</td></tr> </table></p> <p>See also <a href="qtextlength.html#type">type</a>().</p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/QTextLength/QTextLength"></a> <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> <a name="//apple_ref/cpp/instm/QTextLength/rawValue"></a> <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 length. If the length is <a href="qtextlength.html#Type-enum">QTextLength::PercentageLength</a> 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> <a name="//apple_ref/cpp/instm/QTextLength/type"></a> <h3 class="fn"><a name="type"></a><a href="qtextlength.html#Type-enum">Type</a> QTextLength::type () const</h3> <p>Returns the type of this length object.</p> <p>See also <a href="qtextlength.html#Type-enum">QTextLength::Type</a>.</p> <a name="//apple_ref/cpp/instm/QTextLength/value"></a> <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> <a name="//apple_ref/cpp/instm/QTextLength/operator QVariant"></a> <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> <a name="//apple_ref/cpp/instm/QTextLength/operator!="></a> <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> <a name="//apple_ref/cpp/instm/QTextLength/operator=="></a> <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="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>