Notice: Undefined offset: 1 in /home/developpez/www/developpez-com/upload/qt/doc/redir.php on line 39 Qt 4.7: QTextBlockFormat Class Reference
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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QTextBlockFormat Class Reference

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument. More...

 #include <QTextBlockFormat>

Inherits: QTextFormat.

Note: All functions in this class are reentrant.

Public Functions

QTextBlockFormat ()
Qt::Alignment alignment () const
qreal bottomMargin () const
int indent () const
bool isValid () const
qreal leftMargin () const
bool nonBreakableLines () const
PageBreakFlags pageBreakPolicy () const
qreal rightMargin () const
void setAlignment ( Qt::Alignment alignment )
void setBottomMargin ( qreal margin )
void setIndent ( int indentation )
void setLeftMargin ( qreal margin )
void setNonBreakableLines ( bool b )
void setPageBreakPolicy ( PageBreakFlags policy )
void setRightMargin ( qreal margin )
void setTabPositions ( const QList<QTextOption::Tab> & tabs )
void setTextIndent ( qreal indent )
void setTopMargin ( qreal margin )
QList<QTextOption::Tab> tabPositions () const
qreal textIndent () const
qreal topMargin () const

Detailed Description

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with setAlignment(). Margins are controlled by setTopMargin(), setBottomMargin(), setLeftMargin(), setRightMargin(). Overall indentation is set with setIndent(), the indentation of the first line with setTextIndent().

Line breaking can be enabled and disabled with setNonBreakableLines().

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the OutlinePen, ForegroundBrush, and BackgroundBrush QTextFormat::Property values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

See also QTextBlock and QTextCharFormat.

Member Function Documentation

QTextBlockFormat::QTextBlockFormat ()

Constructs a new QTextBlockFormat.

Qt::Alignment QTextBlockFormat::alignment () const

Returns the paragraph's alignment.

See also setAlignment().

qreal QTextBlockFormat::bottomMargin () const

Returns the paragraph's bottom margin.

See also setBottomMargin() and topMargin().

int QTextBlockFormat::indent () const

Returns the paragraph's indent.

See also setIndent().

bool QTextBlockFormat::isValid () const

Returns true if this block format is valid; otherwise returns false.

qreal QTextBlockFormat::leftMargin () const

Returns the paragraph's left margin.

See also setLeftMargin(), rightMargin(), and indent().

bool QTextBlockFormat::nonBreakableLines () const

Returns true if the lines in the paragraph are non-breakable; otherwise returns false.

See also setNonBreakableLines().

PageBreakFlags QTextBlockFormat::pageBreakPolicy () const

Returns the currently set page break policy for the paragraph. The default is QTextFormat::PageBreak_Auto.

This function was introduced in Qt 4.2.

See also setPageBreakPolicy().

qreal QTextBlockFormat::rightMargin () const

Returns the paragraph's right margin.

See also setRightMargin() and leftMargin().

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

Sets the paragraph's alignment.

See also alignment().

void QTextBlockFormat::setBottomMargin ( qreal margin )

Sets the paragraph's bottom margin.

See also bottomMargin(), setTopMargin(), setLeftMargin(), and setRightMargin().

void QTextBlockFormat::setIndent ( int indentation )

Sets the paragraph's indentation. Margins are set independently of indentation with setLeftMargin() and setTextIndent(). The indentation is an integer that is multiplied with the document-wide standard indent, resulting in the actual indent of the paragraph.

See also indent() and QTextDocument::indentWidth().

void QTextBlockFormat::setLeftMargin ( qreal margin )

Sets the paragraph's left margin. Indentation can be applied separately with setIndent().

See also leftMargin(), setRightMargin(), setTopMargin(), and setBottomMargin().

void QTextBlockFormat::setNonBreakableLines ( bool b )

If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.

See also nonBreakableLines().

void QTextBlockFormat::setPageBreakPolicy ( PageBreakFlags policy )

Sets the page break policy for the paragraph to policy.

This function was introduced in Qt 4.2.

See also pageBreakPolicy().

void QTextBlockFormat::setRightMargin ( qreal margin )

Sets the paragraph's right margin.

See also rightMargin(), setLeftMargin(), setTopMargin(), and setBottomMargin().

void QTextBlockFormat::setTabPositions ( const QList<QTextOption::Tab> & tabs )

Sets the tab positions for the text block to those specified by tabs.

This function was introduced in Qt 4.4.

See also tabPositions().

void QTextBlockFormat::setTextIndent ( qreal indent )

Sets the indent for the first line in the block. This allows the first line of a paragraph to be indented differently to the other lines, enhancing the readability of the text.

See also textIndent(), setLeftMargin(), setRightMargin(), setTopMargin(), and setBottomMargin().

void QTextBlockFormat::setTopMargin ( qreal margin )

Sets the paragraph's top margin.

See also topMargin(), setBottomMargin(), setLeftMargin(), and setRightMargin().

QList<QTextOption::Tab> QTextBlockFormat::tabPositions () const

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

This function was introduced in Qt 4.4.

See also setTabPositions().

qreal QTextBlockFormat::textIndent () const

Returns the paragraph's text indent.

See also setTextIndent().

qreal QTextBlockFormat::topMargin () const

Returns the paragraph's top margin.

See also setTopMargin() and bottomMargin().

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.7
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