IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QTextObjectInterface Class

The https:// class allows drawing of custom text objects in https://s.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QTextObjectInterface Class▲

  • Header: QTextObjectInterface

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Gui)

    target_link_libraries(mytarget PRIVATE Qt6::Gui)

  • qmake: QT += gui

  • Inherited By:

Detailed Description▲

A text object describes the structure of one or more elements in a text document; for instance, images imported from HTML are implemented using text objects. A text object knows how to lay out and draw its elements when a document is being rendered.

Qt allows custom text objects to be inserted into a document by registering a custom https:// with https://. A https:// must also be implemented for this type and be https:// with the https:// of the document. When the object type is encountered while rendering a https://, the https://() and https://() functions of the interface are called.

The following list explains the required steps of inserting a custom text object into a document:

  • Choose an objectType. The objectType is an integer with a value greater or equal to https://.

  • Create a https:// object and set the object type to the chosen type using the setObjectType() function.

  • Implement the https:// class.

  • Call https://() with an instance of your https:// subclass to register your object type.

  • Insert https:// with the aforementioned https:// of the chosen object type into the document. As mentioned, the functions of https:// https://() and https://() will then be called with the https:// as parameter whenever the replacement character is encountered.

A class implementing a text object needs to inherit both https:// and https://. https:// must be the first class inherited. For instance:

 
Sélectionnez
class SvgTextObject : public QObject, public QTextObjectInterface
{
    Q_OBJECT
    Q_INTERFACES(QTextObjectInterface)

The data of a text object is usually stored in the https:// using https://(), and then retrieved with https://().

Copy and Paste operations ignore custom text objects.

See Also▲

See also https://, QTextCharFormat, https://

Member Function Documentation▲

 

[virtual] QTextObjectInterface::~QTextObjectInterface()▲

Destroys this https://.

[pure virtual] void QTextObjectInterface::drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format)▲

Draws this text object using the specified painter.

The size of the rectangle, rect, to draw in is the size previously calculated by https://(). The rectangles position is relative to the painter.

You also get the document (doc) and the position (posInDocument) of the format in that document.

See Also▲

See also https://()

[pure virtual] QSizeF QTextObjectInterface::intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format)▲

The intrinsicSize() function returns the size of the text object represented by format in the given document (doc) at the given position (posInDocument).

The size calculated will be used for subsequent calls to https://() for this format.

See Also▲

See also https://()

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Ce document est disponible sous la licence https:// telle que publiée par la Free Software Foundation.