Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QTextOption Class

TheQTextOption class provides a description of general rich text properties.More...

Header:#include <QTextOption>

Note: All functions in this class arereentrant.

Public Types

classTab
enumFlag { IncludeTrailingSpaces, ShowTabsAndSpaces, ShowLineAndParagraphSeparators, AddSpaceForLineAndParagraphSeparators, SuppressColors }
flagsFlags
enumTabType { LeftTab, RightTab, CenterTab, DelimiterTab }
enumWrapMode { NoWrap, WordWrap, ManualWrap, WrapAnywhere, WrapAtWordBoundaryOrAnywhere }

Public Functions

QTextOption()
QTextOption(Qt::Alignment alignment)
QTextOption(const QTextOption & other)
~QTextOption()
Qt::Alignmentalignment() const
Flagsflags() const
voidsetAlignment(Qt::Alignment alignment)
voidsetFlags(Flags flags)
voidsetTabArray(QList<qreal> tabStops)
voidsetTabStop(qreal tabStop)
voidsetTabs(QList<Tab> tabStops)
voidsetTextDirection(Qt::LayoutDirection direction)
voidsetUseDesignMetrics(bool enable)
voidsetWrapMode(WrapMode mode)
QList<qreal>tabArray() const
qrealtabStop() const
QList<Tab>tabs() const
Qt::LayoutDirectiontextDirection() const
booluseDesignMetrics() const
WrapModewrapMode() const
QTextOption &operator=(const QTextOption & other)

Detailed Description

TheQTextOption class provides a description of general rich text properties.

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 alsoQTextEdit,QTextDocument, andQTextCursor.

Member Type Documentation

enum QTextOption::Flag
flags QTextOption::Flags

ConstantValueDescription
QTextOption::IncludeTrailingSpaces0x80000000When 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.
QTextOption::ShowTabsAndSpaces0x1Visualize spaces with little dots, and tabs with little arrows.
QTextOption::ShowLineAndParagraphSeparators0x2Visualize line and paragraph separators with appropriate symbol characters.
QTextOption::AddSpaceForLineAndParagraphSeparators0x4While determining the line-break positions take into account the space added for drawing a separator character.
QTextOption::SuppressColors0x8Suppress all color changes in the character formats (except the main selection).

The Flags type is a typedef forQFlags<Flag>. It stores an OR combination of Flag values.

enum QTextOption::TabType

This enum holds the different types of tabulator

ConstantValueDescription
QTextOption::LeftTab0A left-tab
QTextOption::RightTab1A right-tab
QTextOption::CenterTab2A centered-tab
QTextOption::DelimiterTab3A tab stopping at a certain delimiter-character

This enum was introduced or modified in Qt 4.4.

enum QTextOption::WrapMode

This enum describes how text is wrapped in a document.

ConstantValueDescription
QTextOption::NoWrap0Text is not wrapped at all.
QTextOption::WordWrap1Text is wrapped at word boundaries.
QTextOption::ManualWrap2Same as QTextOption::NoWrap
QTextOption::WrapAnywhere3Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
QTextOption::WrapAtWordBoundaryOrAnywhere4If 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.

Member Function Documentation

QTextOption::QTextOption()

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

QTextOption::QTextOption(Qt::Alignment alignment)

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

QTextOption::QTextOption(constQTextOption & other)

Construct a copy of theother text option.

QTextOption::~QTextOption()

Destroys the text option.

Qt::Alignment QTextOption::alignment() const

Returns the text alignment defined by the option.

See alsosetAlignment().

Flags QTextOption::flags() const

Returns the flags associated with the option.

See alsosetFlags().

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

Sets the option's text alignment to the specifiedalignment.

See alsoalignment().

void QTextOption::setFlags(Flags flags)

Sets the flags associated with the option to the givenflags.

See alsoflags().

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

Sets the tab positions for the text layout to those specified bytabStops.

See alsotabArray(),setTabStop(), andsetTabs().

void QTextOption::setTabStop(qreal tabStop)

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

See alsotabStop(),setTabArray(),setTabs(), andtabs().

void QTextOption::setTabs(QList<Tab> tabStops)

Set the Tab properties totabStops.

See alsotabStop() andtabs().

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

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

See alsotextDirection().

void QTextOption::setUseDesignMetrics(bool enable)

Ifenable 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 alsouseDesignMetrics().

void QTextOption::setWrapMode(WrapMode mode)

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

See alsowrapMode().

QList<qreal> QTextOption::tabArray() const

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

See alsosetTabArray() andtabStop().

qreal QTextOption::tabStop() const

Returns the distance in device units between tab stops. Convenient function for the above method

See alsosetTabStop(),tabArray(),setTabs(), andtabs().

QList<Tab> QTextOption::tabs() const

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

This function was introduced in Qt 4.4.

See alsotabStop(),setTabs(), andsetTabStop().

Qt::LayoutDirection QTextOption::textDirection() const

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

See alsosetTextDirection().

bool QTextOption::useDesignMetrics() const

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

See alsosetUseDesignMetrics().

WrapMode QTextOption::wrapMode() const

Returns the text wrap mode defined by the option.

See alsosetWrapMode().

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

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

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp