API reference - Class QTextLayout

Notation used in Ruby API documentation

Module: QtGui

Description: Binding of QTextLayout

Sub-classes: CursorMode, QFlags_CursorMode, FormatRange

Public constructors

new QTextLayoutnewConstructor QTextLayout::QTextLayout()
new QTextLayoutnew(string text)Constructor QTextLayout::QTextLayout(const QString &text)
new QTextLayoutnew(string text,
const QFont font,
QPaintDevice ptr paintdevice = 0)
Constructor QTextLayout::QTextLayout(const QString &text, const QFont &font, QPaintDevice *paintdevice)
new QTextLayoutnew(const QTextBlock b)Constructor QTextLayout::QTextLayout(const QTextBlock &b)

Public methods

void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[const]QTextLayout_FormatRange[]additionalFormatsMethod QList<QTextLayout::FormatRange> QTextLayout::additionalFormats()
voidadditionalFormats=(QTextLayout_FormatRange[] overrides)Method void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange> &overrides)
voidbeginLayoutMethod void QTextLayout::beginLayout()
[const]QRectFboundingRectMethod QRectF QTextLayout::boundingRect()
[const]boolcacheEnabledMethod bool QTextLayout::cacheEnabled()
voidcacheEnabled=(bool enable)Method void QTextLayout::setCacheEnabled(bool enable)
voidclearAdditionalFormatsMethod void QTextLayout::clearAdditionalFormats()
voidclearLayoutMethod void QTextLayout::clearLayout()
QTextLinecreateLineMethod QTextLine QTextLayout::createLine()
[const]Qt_CursorMoveStylecursorMoveStyleMethod Qt::CursorMoveStyle QTextLayout::cursorMoveStyle()
voidcursorMoveStyle=(const Qt_CursorMoveStyle style)Method void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
[const]voiddraw(QPainter ptr p,
const QPointF pos,
QTextLayout_FormatRange[] selections = QVector<QTextLayout::FormatRange>(),
const QRectF clip = QRectF())
Method void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<QTextLayout::FormatRange> &selections, const QRectF &clip)
[const]voiddrawCursor(QPainter ptr p,
const QPointF pos,
int cursorPosition)
Method void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition)
[const]voiddrawCursor(QPainter ptr p,
const QPointF pos,
int cursorPosition,
int width)
Method void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width)
voidendLayoutMethod void QTextLayout::endLayout()
[const]QFontfontMethod QFont QTextLayout::font()
voidfont=(const QFont f)Method void QTextLayout::setFont(const QFont &f)
[const]QGlyphRun[]glyphRuns(int from = -1,
int length = -1)
Method QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length)
[const]boolisValidCursorPosition?(int pos)Method bool QTextLayout::isValidCursorPosition(int pos)
[const]intleftCursorPosition(int oldPos)Method int QTextLayout::leftCursorPosition(int oldPos)
[const]QTextLinelineAt(int i)Method QTextLine QTextLayout::lineAt(int i)
[const]intlineCountMethod int QTextLayout::lineCount()
[const]QTextLinelineForTextPosition(int pos)Method QTextLine QTextLayout::lineForTextPosition(int pos)
[const]doublemaximumWidthMethod double QTextLayout::maximumWidth()
[const]doubleminimumWidthMethod double QTextLayout::minimumWidth()
[const]intnextCursorPosition(int oldPos,
const QTextLayout_CursorMode mode = QTextLayout::SkipCharacters)
Method int QTextLayout::nextCursorPosition(int oldPos, QTextLayout::CursorMode mode)
[const]QPointFpositionMethod QPointF QTextLayout::position()
voidposition=(const QPointF p)Method void QTextLayout::setPosition(const QPointF &p)
[const]intpreeditAreaPositionMethod int QTextLayout::preeditAreaPosition()
[const]stringpreeditAreaTextMethod QString QTextLayout::preeditAreaText()
[const]intpreviousCursorPosition(int oldPos,
const QTextLayout_CursorMode mode = QTextLayout::SkipCharacters)
Method int QTextLayout::previousCursorPosition(int oldPos, QTextLayout::CursorMode mode)
[const]intrightCursorPosition(int oldPos)Method int QTextLayout::rightCursorPosition(int oldPos)
voidsetAdditionalFormats(QTextLayout_FormatRange[] overrides)Method void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange> &overrides)
voidsetCacheEnabled(bool enable)Method void QTextLayout::setCacheEnabled(bool enable)
voidsetCursorMoveStyle(const Qt_CursorMoveStyle style)Method void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
voidsetFlags(int flags)Method void QTextLayout::setFlags(int flags)
voidsetFont(const QFont f)Method void QTextLayout::setFont(const QFont &f)
voidsetPosition(const QPointF p)Method void QTextLayout::setPosition(const QPointF &p)
voidsetPreeditArea(int position,
string text)
Method void QTextLayout::setPreeditArea(int position, const QString &text)
voidsetRawFont(const QRawFont rawFont)Method void QTextLayout::setRawFont(const QRawFont &rawFont)
voidsetText(string string)Method void QTextLayout::setText(const QString &string)
voidsetTextOption(const QTextOption option)Method void QTextLayout::setTextOption(const QTextOption &option)
[const]stringtextMethod QString QTextLayout::text()
voidtext=(string string)Method void QTextLayout::setText(const QString &string)
[const]QTextOptiontextOptionMethod const QTextOption &QTextLayout::textOption()
voidtextOption=(const QTextOption option)Method void QTextLayout::setTextOption(const QTextOption &option)

Public static methods and constants

[static,const]QTextLayout_CursorModeSkipCharactersEnum constant QTextLayout::SkipCharacters
[static,const]QTextLayout_CursorModeSkipWordsEnum constant QTextLayout::SkipWords

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

SkipCharacters

Signature: [static,const] QTextLayout_CursorMode SkipCharacters

Description: Enum constant QTextLayout::SkipCharacters

Python specific notes:
The object exposes a readable attribute 'SkipCharacters'. This is the getter.

SkipWords

Signature: [static,const] QTextLayout_CursorMode SkipWords

Description: Enum constant QTextLayout::SkipWords

Python specific notes:
The object exposes a readable attribute 'SkipWords'. This is the getter.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

additionalFormats

Signature: [const] QTextLayout_FormatRange[] additionalFormats

Description: Method QList<QTextLayout::FormatRange> QTextLayout::additionalFormats()

Python specific notes:
The object exposes a readable attribute 'additionalFormats'. This is the getter.

additionalFormats=

Signature: void additionalFormats= (QTextLayout_FormatRange[] overrides)

Description: Method void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange> &overrides)

Python specific notes:
The object exposes a writable attribute 'additionalFormats'. This is the setter.

beginLayout

Signature: void beginLayout

Description: Method void QTextLayout::beginLayout()

boundingRect

Signature: [const] QRectF boundingRect

Description: Method QRectF QTextLayout::boundingRect()

cacheEnabled

Signature: [const] bool cacheEnabled

Description: Method bool QTextLayout::cacheEnabled()

Python specific notes:
The object exposes a readable attribute 'cacheEnabled'. This is the getter.

cacheEnabled=

Signature: void cacheEnabled= (bool enable)

Description: Method void QTextLayout::setCacheEnabled(bool enable)

Python specific notes:
The object exposes a writable attribute 'cacheEnabled'. This is the setter.

clearAdditionalFormats

Signature: void clearAdditionalFormats

Description: Method void QTextLayout::clearAdditionalFormats()

clearLayout

Signature: void clearLayout

Description: Method void QTextLayout::clearLayout()

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

createLine

Signature: QTextLine createLine

Description: Method QTextLine QTextLayout::createLine()

cursorMoveStyle

Signature: [const] Qt_CursorMoveStyle cursorMoveStyle

Description: Method Qt::CursorMoveStyle QTextLayout::cursorMoveStyle()

Python specific notes:
The object exposes a readable attribute 'cursorMoveStyle'. This is the getter.

cursorMoveStyle=

Signature: void cursorMoveStyle= (const Qt_CursorMoveStyle style)

Description: Method void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)

Python specific notes:
The object exposes a writable attribute 'cursorMoveStyle'. This is the setter.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

draw

Signature: [const] void draw (QPainter ptr p, const QPointF pos, QTextLayout_FormatRange[] selections = QVector<QTextLayout::FormatRange>(), const QRectF clip = QRectF())

Description: Method void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<QTextLayout::FormatRange> &selections, const QRectF &clip)

drawCursor

(1) Signature: [const] void drawCursor (QPainter ptr p, const QPointF pos, int cursorPosition)

Description: Method void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition)

(2) Signature: [const] void drawCursor (QPainter ptr p, const QPointF pos, int cursorPosition, int width)

Description: Method void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width)

endLayout

Signature: void endLayout

Description: Method void QTextLayout::endLayout()

font

Signature: [const] QFont font

Description: Method QFont QTextLayout::font()

Python specific notes:
The object exposes a readable attribute 'font'. This is the getter.

font=

Signature: void font= (const QFont f)

Description: Method void QTextLayout::setFont(const QFont &f)

Python specific notes:
The object exposes a writable attribute 'font'. This is the setter.

glyphRuns

Signature: [const] QGlyphRun[] glyphRuns (int from = -1, int length = -1)

Description: Method QList<QGlyphRun> QTextLayout::glyphRuns(int from, int length)

isValidCursorPosition?

Signature: [const] bool isValidCursorPosition? (int pos)

Description: Method bool QTextLayout::isValidCursorPosition(int pos)

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

leftCursorPosition

Signature: [const] int leftCursorPosition (int oldPos)

Description: Method int QTextLayout::leftCursorPosition(int oldPos)

lineAt

Signature: [const] QTextLine lineAt (int i)

Description: Method QTextLine QTextLayout::lineAt(int i)

lineCount

Signature: [const] int lineCount

Description: Method int QTextLayout::lineCount()

lineForTextPosition

Signature: [const] QTextLine lineForTextPosition (int pos)

Description: Method QTextLine QTextLayout::lineForTextPosition(int pos)

maximumWidth

Signature: [const] double maximumWidth

Description: Method double QTextLayout::maximumWidth()

minimumWidth

Signature: [const] double minimumWidth

Description: Method double QTextLayout::minimumWidth()

new

(1) Signature: [static] new QTextLayout new

Description: Constructor QTextLayout::QTextLayout()

This method creates an object of class QTextLayout.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new QTextLayout new (string text)

Description: Constructor QTextLayout::QTextLayout(const QString &text)

This method creates an object of class QTextLayout.

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new QTextLayout new (string text, const QFont font, QPaintDevice ptr paintdevice = 0)

Description: Constructor QTextLayout::QTextLayout(const QString &text, const QFont &font, QPaintDevice *paintdevice)

This method creates an object of class QTextLayout.

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new QTextLayout new (const QTextBlock b)

Description: Constructor QTextLayout::QTextLayout(const QTextBlock &b)

This method creates an object of class QTextLayout.

Python specific notes:
This method is the default initializer of the object.

nextCursorPosition

Signature: [const] int nextCursorPosition (int oldPos, const QTextLayout_CursorMode mode = QTextLayout::SkipCharacters)

Description: Method int QTextLayout::nextCursorPosition(int oldPos, QTextLayout::CursorMode mode)

position

Signature: [const] QPointF position

Description: Method QPointF QTextLayout::position()

Python specific notes:
The object exposes a readable attribute 'position'. This is the getter.

position=

Signature: void position= (const QPointF p)

Description: Method void QTextLayout::setPosition(const QPointF &p)

Python specific notes:
The object exposes a writable attribute 'position'. This is the setter.

preeditAreaPosition

Signature: [const] int preeditAreaPosition

Description: Method int QTextLayout::preeditAreaPosition()

preeditAreaText

Signature: [const] string preeditAreaText

Description: Method QString QTextLayout::preeditAreaText()

previousCursorPosition

Signature: [const] int previousCursorPosition (int oldPos, const QTextLayout_CursorMode mode = QTextLayout::SkipCharacters)

Description: Method int QTextLayout::previousCursorPosition(int oldPos, QTextLayout::CursorMode mode)

rightCursorPosition

Signature: [const] int rightCursorPosition (int oldPos)

Description: Method int QTextLayout::rightCursorPosition(int oldPos)

setAdditionalFormats

Signature: void setAdditionalFormats (QTextLayout_FormatRange[] overrides)

Description: Method void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange> &overrides)

Python specific notes:
The object exposes a writable attribute 'additionalFormats'. This is the setter.

setCacheEnabled

Signature: void setCacheEnabled (bool enable)

Description: Method void QTextLayout::setCacheEnabled(bool enable)

Python specific notes:
The object exposes a writable attribute 'cacheEnabled'. This is the setter.

setCursorMoveStyle

Signature: void setCursorMoveStyle (const Qt_CursorMoveStyle style)

Description: Method void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)

Python specific notes:
The object exposes a writable attribute 'cursorMoveStyle'. This is the setter.

setFlags

Signature: void setFlags (int flags)

Description: Method void QTextLayout::setFlags(int flags)

setFont

Signature: void setFont (const QFont f)

Description: Method void QTextLayout::setFont(const QFont &f)

Python specific notes:
The object exposes a writable attribute 'font'. This is the setter.

setPosition

Signature: void setPosition (const QPointF p)

Description: Method void QTextLayout::setPosition(const QPointF &p)

Python specific notes:
The object exposes a writable attribute 'position'. This is the setter.

setPreeditArea

Signature: void setPreeditArea (int position, string text)

Description: Method void QTextLayout::setPreeditArea(int position, const QString &text)

setRawFont

Signature: void setRawFont (const QRawFont rawFont)

Description: Method void QTextLayout::setRawFont(const QRawFont &rawFont)

setText

Signature: void setText (string string)

Description: Method void QTextLayout::setText(const QString &string)

Python specific notes:
The object exposes a writable attribute 'text'. This is the setter.

setTextOption

Signature: void setTextOption (const QTextOption option)

Description: Method void QTextLayout::setTextOption(const QTextOption &option)

Python specific notes:
The object exposes a writable attribute 'textOption'. This is the setter.

text

Signature: [const] string text

Description: Method QString QTextLayout::text()

Python specific notes:
The object exposes a readable attribute 'text'. This is the getter.

text=

Signature: void text= (string string)

Description: Method void QTextLayout::setText(const QString &string)

Python specific notes:
The object exposes a writable attribute 'text'. This is the setter.

textOption

Signature: [const] QTextOption textOption

Description: Method const QTextOption &QTextLayout::textOption()

Python specific notes:
The object exposes a readable attribute 'textOption'. This is the getter.

textOption=

Signature: void textOption= (const QTextOption option)

Description: Method void QTextLayout::setTextOption(const QTextOption &option)

Python specific notes:
The object exposes a writable attribute 'textOption'. This is the setter.