<?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"> <!-- qtextoption.cpp --> <head> <title>Qt 4.6: QTextOption Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl//QTextOption"></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">QTextOption Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span> </h1> <p>The QTextOption class provides a description of general rich text properties. <a href="#details">More...</a></p> <pre> #include <QTextOption></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p> <ul> <li><a href="qtextoption-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">class </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption-tab.html">Tab</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#Flag-enum">Flag</a></b> { IncludeTrailingSpaces, ShowTabsAndSpaces, ShowLineAndParagraphSeparators, AddSpaceForLineAndParagraphSeparators, SuppressColors }</td></tr> <tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#Flag-enum">Flags</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#TabType-enum">TabType</a></b> { LeftTab, RightTab, CenterTab, DelimiterTab }</td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#WrapMode-enum">WrapMode</a></b> { NoWrap, WordWrap, ManualWrap, WrapAnywhere, WrapAtWordBoundaryOrAnywhere }</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="qtextoption.html#QTextOption">QTextOption</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#QTextOption-2">QTextOption</a></b> ( Qt::Alignment <i>alignment</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#QTextOption-3">QTextOption</a></b> ( const QTextOption & <i>other</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#dtor.QTextOption">~QTextOption</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">Qt::Alignment </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#alignment">alignment</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">Flags </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#flags">flags</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setAlignment">setAlignment</a></b> ( Qt::Alignment <i>alignment</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setFlags">setFlags</a></b> ( Flags <i>flags</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setTabArray">setTabArray</a></b> ( QList<qreal> <i>tabStops</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setTabStop">setTabStop</a></b> ( qreal <i>tabStop</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setTabs">setTabs</a></b> ( QList<Tab> <i>tabStops</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setTextDirection">setTextDirection</a></b> ( Qt::LayoutDirection <i>direction</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setUseDesignMetrics">setUseDesignMetrics</a></b> ( bool <i>enable</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#setWrapMode">setWrapMode</a></b> ( WrapMode <i>mode</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QList<qreal> </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#tabArray">tabArray</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">qreal </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#tabStop">tabStop</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QList<Tab> </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#tabs">tabs</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">Qt::LayoutDirection </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#textDirection">textDirection</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#useDesignMetrics">useDesignMetrics</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">WrapMode </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#wrapMode">wrapMode</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QTextOption & </td><td class="memItemRight" valign="bottom"><b><a href="qtextoption.html#operator-eq">operator=</a></b> ( const QTextOption & <i>other</i> )</td></tr> </table> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QTextOption class provides a description of general rich text properties.</p> <p>QTextOption is used to encapsulate common rich text properties in a single object. It contains information about text alignment, layout direction, word wrapping, and other standard properties associated with text rendering and layout.</p> <p>See also <a href="qtextedit.html">QTextEdit</a>, <a href="qtextdocument.html">QTextDocument</a>, and <a href="qtextcursor.html">QTextCursor</a>.</p> <hr /> <h2>Member Type Documentation</h2> <a name="//apple_ref/cpp/tag/QTextOption/Flag"></a> <a name="//apple_ref/cpp/econst/QTextOption/IncludeTrailingSpaces"></a> <a name="//apple_ref/cpp/econst/QTextOption/ShowTabsAndSpaces"></a> <a name="//apple_ref/cpp/econst/QTextOption/ShowLineAndParagraphSeparators"></a> <a name="//apple_ref/cpp/econst/QTextOption/AddSpaceForLineAndParagraphSeparators"></a> <a name="//apple_ref/cpp/econst/QTextOption/SuppressColors"></a> <a name="//apple_ref/cpp/tdef/QTextOption/Flags"></a> <h3 class="flags"><a name="Flag-enum"></a>enum QTextOption::Flag<br />flags QTextOption::Flags</h3> <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>QTextOption::IncludeTrailingSpaces</tt></td><td align="center" valign="top"><tt>0x80000000</tt></td><td valign="top">When this option is set, <a href="qtextline.html#naturalTextWidth">QTextLine::naturalTextWidth</a>() and naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded.</td></tr> <tr><td valign="top"><tt>QTextOption::ShowTabsAndSpaces</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">Visualize spaces with little dots, and tabs with little arrows.</td></tr> <tr><td valign="top"><tt>QTextOption::ShowLineAndParagraphSeparators</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">Visualize line and paragraph separators with appropriate symbol characters.</td></tr> <tr><td valign="top"><tt>QTextOption::AddSpaceForLineAndParagraphSeparators</tt></td><td align="center" valign="top"><tt>0x4</tt></td><td valign="top">While determining the line-break positions take into account the space added for drawing a separator character.</td></tr> <tr><td valign="top"><tt>QTextOption::SuppressColors</tt></td><td align="center" valign="top"><tt>0x8</tt></td><td valign="top">Suppress all color changes in the character formats (except the main selection).</td></tr> </table></p> <p>The Flags type is a typedef for <a href="qflags.html">QFlags</a><Flag>. It stores an OR combination of Flag values.</p> <a name="//apple_ref/cpp/tag/QTextOption/TabType"></a> <a name="//apple_ref/cpp/econst/QTextOption/LeftTab"></a> <a name="//apple_ref/cpp/econst/QTextOption/RightTab"></a> <a name="//apple_ref/cpp/econst/QTextOption/CenterTab"></a> <a name="//apple_ref/cpp/econst/QTextOption/DelimiterTab"></a> <h3 class="fn"><a name="TabType-enum"></a>enum QTextOption::TabType</h3> <p>This enum holds the different types of tabulator</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>QTextOption::LeftTab</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">A left-tab</td></tr> <tr><td valign="top"><tt>QTextOption::RightTab</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">A right-tab</td></tr> <tr><td valign="top"><tt>QTextOption::CenterTab</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">A centered-tab</td></tr> <tr><td valign="top"><tt>QTextOption::DelimiterTab</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">A tab stopping at a certain delimiter-character</td></tr> </table></p> <p>This enum was introduced in Qt 4.4.</p> <a name="//apple_ref/cpp/tag/QTextOption/WrapMode"></a> <a name="//apple_ref/cpp/econst/QTextOption/NoWrap"></a> <a name="//apple_ref/cpp/econst/QTextOption/WordWrap"></a> <a name="//apple_ref/cpp/econst/QTextOption/ManualWrap"></a> <a name="//apple_ref/cpp/econst/QTextOption/WrapAnywhere"></a> <a name="//apple_ref/cpp/econst/QTextOption/WrapAtWordBoundaryOrAnywhere"></a> <h3 class="fn"><a name="WrapMode-enum"></a>enum QTextOption::WrapMode</h3> <p>This enum describes how text is wrapped in a document.</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>QTextOption::NoWrap</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Text is not wrapped at all.</td></tr> <tr><td valign="top"><tt>QTextOption::WordWrap</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Text is wrapped at word boundaries.</td></tr> <tr><td valign="top"><tt>QTextOption::ManualWrap</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Same as QTextOption::NoWrap</td></tr> <tr><td valign="top"><tt>QTextOption::WrapAnywhere</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Text can be wrapped at any point on a line, even if it occurs in the middle of a word.</td></tr> <tr><td valign="top"><tt>QTextOption::WrapAtWordBoundaryOrAnywhere</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.</td></tr> </table></p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/QTextOption/QTextOption"></a> <h3 class="fn"><a name="QTextOption"></a>QTextOption::QTextOption ()</h3> <p>Constructs a text option with default properties for text. The text alignment property is set to <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>. The word wrap property is set to <a href="qtextoption.html#WrapMode-enum">QTextOption::WordWrap</a>. The using of design metrics flag is set to false.</p> <h3 class="fn"><a name="QTextOption-2"></a>QTextOption::QTextOption ( <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> <i>alignment</i> )</h3> <p>Constructs a text option with the given <i>alignment</i> for text. The word wrap property is set to <a href="qtextoption.html#WrapMode-enum">QTextOption::WordWrap</a>. The using of design metrics flag is set to false.</p> <h3 class="fn"><a name="QTextOption-3"></a>QTextOption::QTextOption ( const QTextOption & <i>other</i> )</h3> <p>Construct a copy of the <i>other</i> text option.</p> <a name="//apple_ref/cpp/instm/QTextOption/~QTextOption"></a> <h3 class="fn"><a name="dtor.QTextOption"></a>QTextOption::~QTextOption ()</h3> <p>Destroys the text option.</p> <a name="//apple_ref/cpp/instm/QTextOption/alignment"></a> <h3 class="fn"><a name="alignment"></a><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> QTextOption::alignment () const</h3> <p>Returns the text alignment defined by the option.</p> <p>See also <a href="qtextoption.html#setAlignment">setAlignment</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/flags"></a> <h3 class="fn"><a name="flags"></a><a href="qtextoption.html#Flag-enum">Flags</a> QTextOption::flags () const</h3> <p>Returns the flags associated with the option.</p> <p>See also <a href="qtextoption.html#setFlags">setFlags</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setAlignment"></a> <h3 class="fn"><a name="setAlignment"></a>void QTextOption::setAlignment ( <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> <i>alignment</i> )</h3> <p>Sets the option's text alignment to the specified <i>alignment</i>.</p> <p>See also <a href="qtextoption.html#alignment">alignment</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setFlags"></a> <h3 class="fn"><a name="setFlags"></a>void QTextOption::setFlags ( <a href="qtextoption.html#Flag-enum">Flags</a> <i>flags</i> )</h3> <p>Sets the flags associated with the option to the given <i>flags</i>.</p> <p>See also <a href="qtextoption.html#flags">flags</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setTabArray"></a> <h3 class="fn"><a name="setTabArray"></a>void QTextOption::setTabArray ( <a href="qlist.html">QList</a><<a href="qtglobal.html#qreal-typedef">qreal</a>> <i>tabStops</i> )</h3> <p>Sets the tab positions for the text layout to those specified by <i>tabStops</i>.</p> <p>See also <a href="qtextoption.html#tabArray">tabArray</a>(), <a href="qtextoption.html#setTabStop">setTabStop</a>(), and <a href="qtextoption.html#setTabs">setTabs</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setTabStop"></a> <h3 class="fn"><a name="setTabStop"></a>void QTextOption::setTabStop ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>tabStop</i> )</h3> <p>Sets the default distance in device units between tab stops to the value specified by <i>tabStop</i>.</p> <p>See also <a href="qtextoption.html#tabStop">tabStop</a>(), <a href="qtextoption.html#setTabArray">setTabArray</a>(), <a href="qtextoption.html#setTabs">setTabs</a>(), and <a href="qtextoption.html#tabs">tabs</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setTabs"></a> <h3 class="fn"><a name="setTabs"></a>void QTextOption::setTabs ( <a href="qlist.html">QList</a><<a href="qtextoption-tab.html">Tab</a>> <i>tabStops</i> )</h3> <p>Set the Tab properties to <i>tabStops</i>.</p> <p>See also <a href="qtextoption.html#tabStop">tabStop</a>() and <a href="qtextoption.html#tabs">tabs</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setTextDirection"></a> <h3 class="fn"><a name="setTextDirection"></a>void QTextOption::setTextDirection ( <a href="qt.html#LayoutDirection-enum">Qt::LayoutDirection</a> <i>direction</i> )</h3> <p>Sets the direction of the text layout defined by the option to the given <i>direction</i>.</p> <p>See also <a href="qtextoption.html#textDirection">textDirection</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setUseDesignMetrics"></a> <h3 class="fn"><a name="setUseDesignMetrics"></a>void QTextOption::setUseDesignMetrics ( bool <i>enable</i> )</h3> <p>If <i>enable</i> is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).</p> <p>See also <a href="qtextoption.html#useDesignMetrics">useDesignMetrics</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/setWrapMode"></a> <h3 class="fn"><a name="setWrapMode"></a>void QTextOption::setWrapMode ( <a href="qtextoption.html#WrapMode-enum">WrapMode</a> <i>mode</i> )</h3> <p>Sets the option's text wrap mode to the given <i>mode</i>.</p> <p>See also <a href="qtextoption.html#wrapMode">wrapMode</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/tabArray"></a> <h3 class="fn"><a name="tabArray"></a><a href="qlist.html">QList</a><<a href="qtglobal.html#qreal-typedef">qreal</a>> QTextOption::tabArray () const</h3> <p>Returns a list of tab positions defined for the text layout.</p> <p>See also <a href="qtextoption.html#setTabArray">setTabArray</a>() and <a href="qtextoption.html#tabStop">tabStop</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/tabStop"></a> <h3 class="fn"><a name="tabStop"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QTextOption::tabStop () const</h3> <p>Returns the distance in device units between tab stops. Convenient function for the above method</p> <p>See also <a href="qtextoption.html#setTabStop">setTabStop</a>(), <a href="qtextoption.html#tabArray">tabArray</a>(), <a href="qtextoption.html#setTabs">setTabs</a>(), and <a href="qtextoption.html#tabs">tabs</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/tabs"></a> <h3 class="fn"><a name="tabs"></a><a href="qlist.html">QList</a><<a href="qtextoption-tab.html">Tab</a>> QTextOption::tabs () const</h3> <p>Returns a list of tab positions defined for the text layout.</p> <p>This function was introduced in Qt 4.4.</p> <p>See also <a href="qtextoption.html#tabStop">tabStop</a>(), <a href="qtextoption.html#setTabs">setTabs</a>(), and <a href="qtextoption.html#setTabStop">setTabStop</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/textDirection"></a> <h3 class="fn"><a name="textDirection"></a><a href="qt.html#LayoutDirection-enum">Qt::LayoutDirection</a> QTextOption::textDirection () const</h3> <p>Returns the direction of the text layout defined by the option.</p> <p>See also <a href="qtextoption.html#setTextDirection">setTextDirection</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/useDesignMetrics"></a> <h3 class="fn"><a name="useDesignMetrics"></a>bool QTextOption::useDesignMetrics () const</h3> <p>Returns true if the layout uses design rather than device metrics; otherwise returns false.</p> <p>See also <a href="qtextoption.html#setUseDesignMetrics">setUseDesignMetrics</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/wrapMode"></a> <h3 class="fn"><a name="wrapMode"></a><a href="qtextoption.html#WrapMode-enum">WrapMode</a> QTextOption::wrapMode () const</h3> <p>Returns the text wrap mode defined by the option.</p> <p>See also <a href="qtextoption.html#setWrapMode">setWrapMode</a>().</p> <a name="//apple_ref/cpp/instm/QTextOption/operator="></a> <h3 class="fn"><a name="operator-eq"></a>QTextOption & QTextOption::operator= ( const QTextOption & <i>other</i> )</h3> <p>Returns true if the text option is the same as the <i>other</i> text option; otherwise returns false.</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>