Skip to content

PythonQt.QtGui.QAbstractTextDocumentLayout · declarations 001

Back to PythonQt.QtGui.QAbstractTextDocumentLayout

PaintContext instance-attribute

PaintContext: type

PythonQtInstanceWrapper object

Selection instance-attribute

Selection: type

PythonQtInstanceWrapper object

anchorAt

anchorAt(pos: Any) -> str

X.anchorAt(pos) -> str

Supplemental documentation: Qt 5 reference:

QString QAbstractTextDocumentLayout::anchorAt(const QPointF \&position) const

Returns the reference of the anchor the given position, or an empty string if no anchor exists at that point.

Upstream PySide2 reference signatures (binding differences may apply):

anchorAt(self, pos: PySide2.QtCore.QPointF) -> str

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#anchorAt

blockBoundingRect

blockBoundingRect(block: Any) -> Any

X.blockBoundingRect(block) -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

[pure virtual] QRectF QAbstractTextDocumentLayout::blockBoundingRect(const QTextBlock \&block) const

Returns the bounding rectangle of block.

Upstream PySide2 reference signatures (binding differences may apply):

blockBoundingRect(self, block: PySide2.QtGui.QTextBlock) -> PySide2.QtCore.QRectF

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#blockBoundingRect

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractTextDocumentLayout.destroyed; argument details are not documented.

document

document() -> Any

X.document() -> PythonQt.QtGui.QTextDocument

Supplemental documentation: Qt 5 reference:

QTextDocument *QAbstractTextDocumentLayout::document() const

Returns the text document that this layout is operating on.

Upstream PySide2 reference signatures (binding differences may apply):

document(self) -> PySide2.QtGui.QTextDocument

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#document

documentChanged

documentChanged(*args: Any, **kwargs: Any) -> None

X.documentChanged(from, charsRemoved, charsAdded)

Supplemental documentation: Qt 5 reference:

[pure virtual protected] void QAbstractTextDocumentLayout::documentChanged(int position, int charsRemoved, int charsAdded)

This function is called whenever the contents of the document change. A change occurs when text is inserted, removed, or a combination of these two. The change is specified by position, charsRemoved, and charsAdded corresponding to the starting character position of the change, the number of characters removed from the document, and the number of characters added.

For example, when inserting the text "Hello" into an empty document, charsRemoved would be 0 and charsAdded would be 5 (the length of the string).

Replacing text is a combination of removing and inserting. For example, if the text "Hello" gets replaced by "Hi", charsRemoved would be 5 and charsAdded would be 2.

For subclasses of QAbstractTextDocumentLayout, this is the central function where a large portion of the work to lay out and position document contents is done.

For example, in a subclass that only arranges blocks of text, an implementation of this function would have to do the following:

  • Determine the list of changed QTextBlock(s) using the parameters provided.
  • Each QTextBlock object's corresponding QTextLayout object needs to be processed. You can access the QTextBlock's layout using the QTextBlock::layout() function. This processing should take the document's page size into consideration.
  • If the total number of pages changed, the pageCountChanged() signal should be emitted.
  • If the total size changed, the documentSizeChanged() signal should be emitted.
  • The update() signal should be emitted to schedule a repaint of areas in the layout that require repainting.

See also QTextLayout.

Upstream PySide2 reference signatures (binding differences may apply):

documentChanged(self, from_: int, charsRemoved: int, charsAdded: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#documentChanged

documentSize

documentSize() -> Any

X.documentSize() -> PythonQt.QtCore.QSizeF

Supplemental documentation: Qt 5 reference:

[pure virtual] QSizeF QAbstractTextDocumentLayout::documentSize() const

Returns the total size of the document's layout.

This information can be used by display widgets to update their scroll bars correctly.

See also documentSizeChanged() and QTextDocument::pageSize.

Upstream PySide2 reference signatures (binding differences may apply):

documentSize(self) -> PySide2.QtCore.QSizeF

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#documentSize

documentSizeChanged

documentSizeChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractTextDocumentLayout.documentSizeChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractTextDocumentLayout::documentSizeChanged(const QSizeF \&newSize)

This signal is emitted when the size of the document layout changes to newSize.

Subclasses of QAbstractTextDocumentLayout should emit this signal when the document's entire layout size changes. This signal is useful for widgets that display text documents since it enables them to update their scroll bars correctly.

See also documentSize().

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#documentSizeChanged

draw

draw(painter: Any, context: Any) -> None

X.draw(painter, context)

Supplemental documentation: Qt 5 reference:

[pure virtual] void QAbstractTextDocumentLayout::draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext \&context)

Draws the layout with the given painter using the given context.

Upstream PySide2 reference signatures (binding differences may apply):

draw(self, painter: PySide2.QtGui.QPainter, context: PySide2.QtGui.QAbstractTextDocumentLayout.PaintContext) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#draw

drawInlineObject

drawInlineObject(painter: Any, rect: Any, object: Any, posInDocument: int, format: Any) -> None

X.drawInlineObject(painter, rect, object, posInDocument, format)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QAbstractTextDocumentLayout::drawInlineObject(QPainter *painter, const QRectF \&rect, QTextInlineObject object, int posInDocument, const QTextFormat \&format)

This function is called to draw the inline object, object, with the given painter within the rectangle specified by rect using the specified text format.

posInDocument specifies the position of the object within the document.

The default implementation calls drawObject() on the object handlers. This function is called only within Qt. Subclasses can reimplement this function to customize the drawing of inline objects.

See also draw().

Upstream PySide2 reference signatures (binding differences may apply):

drawInlineObject(self, painter: PySide2.QtGui.QPainter, rect: PySide2.QtCore.QRectF, object: PySide2.QtGui.QTextInlineObject, posInDocument: int, format: PySide2.QtGui.QTextFormat) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#drawInlineObject

format

format(pos: int) -> Any

X.format(pos) -> PythonQt.QtGui.QTextCharFormat

Supplemental documentation: Qt 5 reference:

[protected] QTextCharFormat QAbstractTextDocumentLayout::format(int position)

Returns the character format that is applicable at the given position.

Upstream PySide2 reference signatures (binding differences may apply):

format(self, pos: int) -> PySide2.QtGui.QTextCharFormat

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#format

formatIndex

formatIndex(pos: int) -> int

X.formatIndex(pos) -> int

Upstream PySide2 reference signatures (binding differences may apply):

formatIndex(self, pos: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#formatIndex

frameBoundingRect

frameBoundingRect(frame: Any) -> Any

X.frameBoundingRect(frame) -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

[pure virtual] QRectF QAbstractTextDocumentLayout::frameBoundingRect(QTextFrame *frame) const

Returns the bounding rectangle of frame.

Upstream PySide2 reference signatures (binding differences may apply):

frameBoundingRect(self, frame: PySide2.QtGui.QTextFrame) -> PySide2.QtCore.QRectF

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#frameBoundingRect

hitTest

hitTest(point: Any, accuracy: Any) -> int

X.hitTest(point, accuracy) -> int

Supplemental documentation: Qt 5 reference:

[pure virtual] int QAbstractTextDocumentLayout::hitTest(const QPointF \&point, Qt::HitTestAccuracy accuracy) const

Returns the cursor position for the given point with the specified accuracy. Returns -1 if no valid cursor position was found.

Upstream PySide2 reference signatures (binding differences may apply):

hitTest(self, point: PySide2.QtCore.QPointF, accuracy: PySide2.QtCore.Qt.HitTestAccuracy) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#hitTest

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractTextDocumentLayout.objectNameChanged; argument details are not documented.

pageCount

pageCount() -> int

X.pageCount() -> int

Supplemental documentation: Qt 5 reference:

[pure virtual] int QAbstractTextDocumentLayout::pageCount() const

Returns the number of pages contained in the layout.

See also pageCountChanged().

Upstream PySide2 reference signatures (binding differences may apply):

pageCount(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#pageCount

pageCountChanged

pageCountChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractTextDocumentLayout.pageCountChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractTextDocumentLayout::pageCountChanged(int newPages)

This signal is emitted when the number of pages in the layout changes; newPages is the updated page count.

Subclasses of QAbstractTextDocumentLayout should emit this signal when the number of pages in the layout has changed. Changes to the page count are caused by changes to the layout or the document content itself.

See also pageCount().

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#pageCountChanged

paintDevice

paintDevice() -> Any

X.paintDevice() -> PythonQt.QtGui.QPaintDevice

Supplemental documentation: Qt 5 reference:

QPaintDevice *QAbstractTextDocumentLayout::paintDevice() const

Returns the paint device used to render the document's layout.

See also setPaintDevice().

Upstream PySide2 reference signatures (binding differences may apply):

paintDevice(self) -> PySide2.QtGui.QPaintDevice

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#paintDevice

positionInlineObject

positionInlineObject(item: Any, posInDocument: int, format: Any) -> None

X.positionInlineObject(item, posInDocument, format)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QAbstractTextDocumentLayout::positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat \&format)

Lays out the inline object item using the given text format.

posInDocument specifies the position of the object within the document.

The default implementation does nothing. This function is called only within Qt. Subclasses can reimplement this function to customize the position of inline objects.

See also drawInlineObject().

Upstream PySide2 reference signatures (binding differences may apply):

positionInlineObject(self, item: PySide2.QtGui.QTextInlineObject, posInDocument: int, format: PySide2.QtGui.QTextFormat) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#positionInlineObject

registerHandler

registerHandler(objectType: int, component: Any) -> None

X.registerHandler(objectType, component)

Supplemental documentation: Qt 5 reference:

void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject *component)

Registers the given component as a handler for items of the given objectType.

Note: registerHandler() has to be called once for each object type. This means that there is only one handler for multiple replacement characters of the same object type.

The text document layout does not take ownership of component.

Upstream PySide2 reference signatures (binding differences may apply):

registerHandler(self, objectType: int, component: PySide2.QtCore.QObject) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#registerHandler

resizeInlineObject

resizeInlineObject(item: Any, posInDocument: int, format: Any) -> None

X.resizeInlineObject(item, posInDocument, format)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QAbstractTextDocumentLayout::resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat \&format)

Sets the size of the inline object item corresponding to the text format.

posInDocument specifies the position of the object within the document.

The default implementation resizes the item to the size returned by the object handler's intrinsicSize() function. This function is called only within Qt. Subclasses can reimplement this function to customize the resizing of inline objects.

Upstream PySide2 reference signatures (binding differences may apply):

resizeInlineObject(self, item: PySide2.QtGui.QTextInlineObject, posInDocument: int, format: PySide2.QtGui.QTextFormat) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#resizeInlineObject

setPaintDevice

setPaintDevice(device: Any) -> None

X.setPaintDevice(device)

Supplemental documentation: Qt 5 reference:

void QAbstractTextDocumentLayout::setPaintDevice(QPaintDevice *device)

Sets the paint device used for rendering the document's layout to the given device.

See also paintDevice().

Upstream PySide2 reference signatures (binding differences may apply):

setPaintDevice(self, device: PySide2.QtGui.QPaintDevice) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#setPaintDevice

unregisterHandler

unregisterHandler(objectType: int, component: Any) -> None

X.unregisterHandler(objectType, component)

Supplemental documentation: Qt 5 reference:

void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject *component \= nullptr)

Unregisters the given component as a handler for items of the given objectType, or any handler if the component is not specified.

This function was introduced in Qt 5.2.

Upstream PySide2 reference signatures (binding differences may apply):

unregisterHandler(self, objectType: int, component: typing.Optional[PySide2.QtCore.QObject]=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#unregisterHandler

update

update(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractTextDocumentLayout.update; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractTextDocumentLayout::update(const QRectF \&rect \= QRectF(0., 0., 1000000000., 1000000000.))

This signal is emitted when the rectangle rect has been updated.

Subclasses of QAbstractTextDocumentLayout should emit this signal when the layout of the contents change in order to repaint.

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#update

updateBlock

updateBlock(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QAbstractTextDocumentLayout.updateBlock; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractTextDocumentLayout::updateBlock(const QTextBlock \&block)

This signal is emitted when the specified block has been updated.

Subclasses of QAbstractTextDocumentLayout should emit this signal when the layout of block has changed in order to repaint.

This function was introduced in Qt 4.4.

Source: https://doc.qt.io/archives/qt-5.15/qabstracttextdocumentlayout.html#updateBlock