QtBase  v6.3.1
Classes | Public Types | Public Member Functions | List of all members
QTextOption Class Reference

The QTextOption class provides a description of general rich text properties. \inmodule QtGui. More...

#include <qtextoption.h>

Classes

class  Tab
 

Public Types

enum  TabType { LeftTab , RightTab , CenterTab , DelimiterTab }
 
enum  WrapMode {
  NoWrap , WordWrap , ManualWrap , WrapAnywhere ,
  WrapAtWordBoundaryOrAnywhere
}
 
enum  Flag {
  ShowTabsAndSpaces = 0x1 , ShowLineAndParagraphSeparators = 0x2 , AddSpaceForLineAndParagraphSeparators = 0x4 , SuppressColors = 0x8 ,
  ShowDocumentTerminator = 0x10 , IncludeTrailingSpaces = 0x80000000
}
 

Public Member Functions

 QTextOption ()
 
Q_IMPLICIT QTextOption (Qt::Alignment alignment)
 
 ~QTextOption ()
 
 QTextOption (const QTextOption &o)
 
QTextOptionoperator= (const QTextOption &o)
 
void setAlignment (Qt::Alignment alignment)
 
Qt::Alignment alignment () const
 
void setTextDirection (Qt::LayoutDirection aDirection)
 
Qt::LayoutDirection textDirection () const
 
void setWrapMode (WrapMode wrap)
 
WrapMode wrapMode () const
 
void setFlags (Flags flags)
 
Flags flags () const
 
void setTabStopDistance (qreal tabStopDistance)
 
qreal tabStopDistance () const
 
void setTabArray (const QList< qreal > &tabStops)
 
QList< qrealtabArray () const
 
void setTabs (const QList< Tab > &tabStops)
 
QList< Tabtabs () const
 
void setUseDesignMetrics (bool b)
 
bool useDesignMetrics () const
 

Detailed Description

The QTextOption class provides a description of general rich text properties. \inmodule QtGui.

\reentrant

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.

See also
QTextEdit, QTextDocument, QTextCursor

Definition at line 53 of file qtextoption.h.

Member Enumeration Documentation

◆ Flag

\value IncludeTrailingSpaces When this option is set, QTextLine::naturalTextWidth() and naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded. \value ShowTabsAndSpaces Visualize spaces with little dots, and tabs with little arrows. Non-breaking spaces are shown differently to breaking spaces. \value ShowLineAndParagraphSeparators Visualize line and paragraph separators with appropriate symbol characters. \value ShowDocumentTerminator Visualize the end of the document with a section sign. This enum value was added in Qt 5.7. \value AddSpaceForLineAndParagraphSeparators While determining the line-break positions take into account the space added for drawing a separator character. \value SuppressColors Suppress all color changes in the character formats (except the main selection).

Enumerator
ShowTabsAndSpaces 
ShowLineAndParagraphSeparators 
AddSpaceForLineAndParagraphSeparators 
SuppressColors 
ShowDocumentTerminator 
IncludeTrailingSpaces 

Definition at line 106 of file qtextoption.h.

◆ TabType

Since
4.4

This enum holds the different types of tabulator

\value LeftTab A left-tab \value RightTab A right-tab \value CenterTab A centered-tab \value DelimiterTab A tab stopping at a certain delimiter-character

Enumerator
LeftTab 
RightTab 
CenterTab 
DelimiterTab 

Definition at line 56 of file qtextoption.h.

◆ WrapMode

This enum describes how text is wrapped in a document.

\value NoWrap Text is not wrapped at all. \value WordWrap Text is wrapped at word boundaries. \value ManualWrap Same as QTextOption::NoWrap \value WrapAnywhere Text can be wrapped at any point on a line, even if it occurs in the middle of a word. \value WrapAtWordBoundaryOrAnywhere 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.

Enumerator
NoWrap 
WordWrap 
ManualWrap 
WrapAnywhere 
WrapAtWordBoundaryOrAnywhere 

Definition at line 96 of file qtextoption.h.

Constructor & Destructor Documentation

◆ QTextOption() [1/3]

QTextOption::QTextOption ( )

Constructs a text option with default properties for text. The text alignment property is set to Qt::AlignLeft. The word wrap property is set to QTextOption::WordWrap. The using of design metrics flag is set to false.

Definition at line 59 of file qtextoption.cpp.

◆ QTextOption() [2/3]

QTextOption::QTextOption ( Qt::Alignment  alignment)

Constructs a text option with the given alignment for text. The word wrap property is set to QTextOption::WordWrap. The using of design metrics flag is set to false.

Definition at line 70 of file qtextoption.cpp.

◆ ~QTextOption()

QTextOption::~QTextOption ( )

Destroys the text option.

Definition at line 85 of file qtextoption.cpp.

◆ QTextOption() [3/3]

QTextOption::QTextOption ( const QTextOption other)

Construct a copy of the other text option.

Definition at line 95 of file qtextoption.cpp.

Member Function Documentation

◆ alignment()

Qt::Alignment QTextOption::alignment ( ) const
inline

Returns the text alignment defined by the option.

See also
setAlignment()

Definition at line 91 of file qtextoption.h.

◆ flags()

Flags QTextOption::flags ( ) const
inline

Returns the flags associated with the option.

See also
setFlags()

Definition at line 116 of file qtextoption.h.

Here is the caller graph for this function:

◆ operator=()

QTextOption & QTextOption::operator= ( const QTextOption other)

Returns true if the text option is the same as the other text option; otherwise returns false.

Definition at line 115 of file qtextoption.cpp.

◆ setAlignment()

void QTextOption::setAlignment ( Qt::Alignment  alignment)
inline

Sets the option's text alignment to the specified alignment.

See also
alignment()

Definition at line 143 of file qtextoption.h.

Here is the caller graph for this function:

◆ setFlags()

void QTextOption::setFlags ( Flags  flags)
inline

Sets the flags associated with the option to the given flags.

See also
flags()

Definition at line 146 of file qtextoption.h.

◆ setTabArray()

void QTextOption::setTabArray ( const QList< qreal > &  tabStops)

Sets the tab positions for the text layout to those specified by tabStops.

See also
tabArray(), setTabStopDistance(), setTabs()

Definition at line 142 of file qtextoption.cpp.

Here is the call graph for this function:

◆ setTabs()

void QTextOption::setTabs ( const QList< Tab > &  tabStops)
Since
4.4 Sets the tab positions for the text layout to those specified by tabStops.
See also
tabStopDistance()

Definition at line 163 of file qtextoption.cpp.

◆ setTabStopDistance()

void QTextOption::setTabStopDistance ( qreal  tabStopDistance)
inline
Since
5.10

Sets the default distance in device units between tab stops to the value specified by tabStopDistance.

See also
tabStopDistance(), setTabArray(), setTabs(), tabs()

Definition at line 149 of file qtextoption.h.

Here is the caller graph for this function:

◆ setTextDirection()

void QTextOption::setTextDirection ( Qt::LayoutDirection  direction)
inline

Sets the direction of the text layout defined by the option to the given direction.

See also
textDirection()

Definition at line 93 of file qtextoption.h.

Here is the caller graph for this function:

◆ setUseDesignMetrics()

void QTextOption::setUseDesignMetrics ( bool  enable)
inline

If enable is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).

See also
useDesignMetrics()

Definition at line 127 of file qtextoption.h.

◆ setWrapMode()

void QTextOption::setWrapMode ( WrapMode  mode)
inline

Sets the option's text wrap mode to the given mode.

Definition at line 103 of file qtextoption.h.

Here is the caller graph for this function:

◆ tabArray()

QList< qreal > QTextOption::tabArray ( ) const

Returns a list of tab positions defined for the text layout.

See also
setTabArray(), tabStopDistance()

Definition at line 175 of file qtextoption.cpp.

Here is the call graph for this function:

◆ tabs()

QList< QTextOption::Tab > QTextOption::tabs ( ) const
Since
4.4

Returns a list of tab positions defined for the text layout.

See also
tabStopDistance(), setTabs(), setTabStopDistance()

Definition at line 191 of file qtextoption.cpp.

Here is the caller graph for this function:

◆ tabStopDistance()

qreal QTextOption::tabStopDistance ( ) const
inline
Since
5.10

Returns the distance in device units between tab stops.

See also
setTabStopDistance(), tabArray(), setTabs(), tabs()

Definition at line 119 of file qtextoption.h.

◆ textDirection()

Qt::LayoutDirection QTextOption::textDirection ( ) const
inline

Returns the direction of the text layout defined by the option.

See also
setTextDirection()

Definition at line 94 of file qtextoption.h.

◆ useDesignMetrics()

bool QTextOption::useDesignMetrics ( ) const
inline

Returns true if the layout uses design rather than device metrics; otherwise returns false.

See also
setUseDesignMetrics()

Definition at line 128 of file qtextoption.h.

◆ wrapMode()

WrapMode QTextOption::wrapMode ( ) const
inline

Returns the text wrap mode defined by the option.

See also
setWrapMode()

Definition at line 104 of file qtextoption.h.


The documentation for this class was generated from the following files: