Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QAbstractTextDocumentLayout Class Reference
[QtGui module]

The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for QTextDocuments. More...

 #include <QAbstractTextDocumentLayout>

Inherits QObject.

Public Types

Public Functions

  • 29 public functions inherited from QObject

Signals

Protected Functions

  • virtual void documentChanged ( int position, int charsRemoved, int charsAdded ) = 0
  • virtual void drawInlineObject ( QPainter * painter, const QRectF & rect, QTextInlineObject object, int posInDocument, const QTextFormat & format )
  • QTextCharFormat format ( int position )
  • virtual void positionInlineObject ( QTextInlineObject item, int posInDocument, const QTextFormat & format )
  • virtual void resizeInlineObject ( QTextInlineObject item, int posInDocument, const QTextFormat & format )
  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 5 static public members inherited from QObject

Detailed Description

The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for QTextDocuments.

The standard layout provided by Qt can handle simple word processing including inline layouts, lists and tables.

Some applications (e.g. a word processor or a DTP application) might need more features than the ones provided by Qt's layout engine, in which case you can subclass QAbstractTextDocumentLayout to provide your own custom layout behavior for your text documents.


Member Function Documentation

QAbstractTextDocumentLayout::QAbstractTextDocumentLayout ( QTextDocument * document )

Creates a new text document layout for the given document.

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

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

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

Returns the bounding rectangle of block.

QTextDocument * QAbstractTextDocumentLayout::document () const

Returns the text document that this layout is operating on.

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

This function is called whenever the contents of the document change. A change occurs when text is inserted, removed, or a combination of the two types of operation. The change is specified by position, charsRemoved, and charsAdded corresponding to the starting character position of the change, the number of character 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 the combination of removal and insertion. For example, if the text "Hello" gets replaced by "Hi", charsRemoved would be 5 and charsAdded would be 2.

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

Returns the total size of the document. This is useful to display widgets since they can use to information to update their scroll bars correctly

See also documentSizeChanged() and QTextDocument::pageSize.

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

This signal is emitted when the size of the document changes. The new size is specified by newSize.

This information is useful to widgets that display text documents since it enables them to update their scroll bars correctly.

See also documentSize().

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

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

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

Called to draw the inline object object on the given painter within the rectangle specified by rect using the text format specified by format. posInDocument specifies the position of the object within the document.

See also draw().

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

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

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

Returns the bounding rectacle of frame. Returns the bounding rectangle of frame.

QTextObjectInterface * QAbstractTextDocumentLayout::handlerForObject ( int objectType ) const

Returns a handler for objects of the given objectType.

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

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

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

Returns the number of pages required by the layout.

See also pageCountChanged().

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

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

Changes to the page count are due to the changes to the layout or the document content itself.

See also pageCount().

QPaintDevice * QAbstractTextDocumentLayout::paintDevice () const

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

See also setPaintDevice().

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

Lays out the inline object item using the given text format. The base class implementation does nothing. posInDocument specifies the position of the object within the document.

See also drawInlineObject().

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

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

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

Sets the size of the inline object item in accordance with the text format. posInDocument specifies the position of the object within the document.

void QAbstractTextDocumentLayout::setPaintDevice ( QPaintDevice * device )

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

See also paintDevice().

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

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

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web