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  · 

QTextOption Class Reference
[QtGui module]

The QTextOption class provides a description of general rich text properties. More...

 #include <QTextOption>

Note: All functions in this class are reentrant.


Public Types

class Tab
enum Flag { IncludeTrailingSpaces, ShowTabsAndSpaces, ShowLineAndParagraphSeparators, AddSpaceForLineAndParagraphSeparators, SuppressColors }
flags Flags
enum TabType { LeftTab, RightTab, CenterTab, DelimiterTab }
enum WrapMode { NoWrap, WordWrap, ManualWrap, WrapAnywhere, WrapAtWordBoundaryOrAnywhere }

Public Functions

QTextOption ()
QTextOption ( Qt::Alignment alignment )
QTextOption ( const QTextOption & other )
~QTextOption ()
Qt::Alignment alignment () const
Flags flags () const
void setAlignment ( Qt::Alignment alignment )
void setFlags ( Flags flags )
void setTabArray ( QList<qreal> tabStops )
void setTabStop ( qreal tabStop )
void setTabs ( QList<Tab> tabStops )
void setTextDirection ( Qt::LayoutDirection direction )
void setUseDesignMetrics ( bool enable )
void setWrapMode ( WrapMode mode )
QList<qreal> tabArray () const
qreal tabStop () const
QList<Tab> tabs () const
Qt::LayoutDirection textDirection () const
bool useDesignMetrics () const
WrapMode wrapMode () const
QTextOption & operator= ( const QTextOption & other )

Detailed Description

The QTextOption class provides a description of general rich text properties.

QTextOption is used to encapsulate common rich text properties in a single object. It contains information about text alignment, layout direction, word wrapping, and other standard properties associated with text rendering and layout.

See also QTextEdit, QTextDocument, and QTextCursor.


Member Type Documentation

enum QTextOption::Flag
flags QTextOption::Flags

ConstantValueDescription
QTextOption::IncludeTrailingSpaces0x80000000When this option is set, QTextLine::naturalTextWidth() and naturalTextRect() will return a value that includes the width of trailing spaces in the text; otherwise this width is excluded.
QTextOption::ShowTabsAndSpaces0x1Visualize spaces with little dots, and tabs with little arrows.
QTextOption::ShowLineAndParagraphSeparators0x2Visualize line and paragraph separators with appropriate symbol characters.
QTextOption::AddSpaceForLineAndParagraphSeparators0x4While determining the line-break positions take into account the space added for drawing a separator character.
QTextOption::SuppressColors0x8Suppress all color changes in the character formats (except the main selection).

The Flags type is a typedef for QFlags<Flag>. It stores an OR combination of Flag values.

enum QTextOption::TabType

This enum holds the different types of tabulator

ConstantValueDescription
QTextOption::LeftTab0A left-tab
QTextOption::RightTab1A right-tab
QTextOption::CenterTab2A centered-tab
QTextOption::DelimiterTab3A tab stopping at a certain delimiter-character

This enum was introduced in Qt 4.4.

enum QTextOption::WrapMode

This enum describes how text is wrapped in a document.

ConstantValueDescription
QTextOption::NoWrap0Text is not wrapped at all.
QTextOption::WordWrap1Text is wrapped at word boundaries.
QTextOption::ManualWrap2Same as QTextOption::NoWrap
QTextOption::WrapAnywhere3Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
QTextOption::WrapAtWordBoundaryOrAnywhere4If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.


Member Function Documentation

QTextOption::QTextOption ()

Constructs a text option with default properties for text. The text alignment property is set to Qt::AlignLeft. The word wrap property is set to QTextOption::WordWrap. The using of design metrics flag is set to false.

QTextOption::QTextOption ( Qt::Alignment alignment )

Constructs a text option with the given alignment for text. The word wrap property is set to QTextOption::WordWrap. The using of design metrics flag is set to false.

QTextOption::QTextOption ( const QTextOption & other )

Construct a copy of the other text option.

QTextOption::~QTextOption ()

Destroys the text option.

Qt::Alignment QTextOption::alignment () const

Returns the text alignment defined by the option.

See also setAlignment().

Flags QTextOption::flags () const

Returns the flags associated with the option.

See also setFlags().

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

Sets the option's text alignment to the specified alignment.

See also alignment().

void QTextOption::setFlags ( Flags flags )

Sets the flags associated with the option to the given flags.

See also flags().

void QTextOption::setTabArray ( QList<qreal> tabStops )

Sets the tab positions for the text layout to those specified by tabStops.

See also tabArray(), setTabStop(), and setTabs().

void QTextOption::setTabStop ( qreal tabStop )

Sets the default distance in device units between tab stops to the value specified by tabStop.

See also tabStop(), setTabArray(), setTabs(), and tabs().

void QTextOption::setTabs ( QList<Tab> tabStops )

Set the Tab properties to tabStops.

See also tabStop() and tabs().

void QTextOption::setTextDirection ( Qt::LayoutDirection direction )

Sets the direction of the text layout defined by the option to the given direction.

See also textDirection().

void QTextOption::setUseDesignMetrics ( bool enable )

If enable is true then the layout will use design metrics; otherwise it will use the metrics of the paint device (which is the default behavior).

See also useDesignMetrics().

void QTextOption::setWrapMode ( WrapMode mode )

Sets the option's text wrap mode to the given mode.

See also wrapMode().

QList<qreal> QTextOption::tabArray () const

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

See also setTabArray() and tabStop().

qreal QTextOption::tabStop () const

Returns the distance in device units between tab stops. Convenient function for the above method

See also setTabStop(), tabArray(), setTabs(), and tabs().

QList<Tab> QTextOption::tabs () const

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

This function was introduced in Qt 4.4.

See also tabStop(), setTabs(), and setTabStop().

Qt::LayoutDirection QTextOption::textDirection () const

Returns the direction of the text layout defined by the option.

See also setTextDirection().

bool QTextOption::useDesignMetrics () const

Returns true if the layout uses design rather than device metrics; otherwise returns false.

See also setUseDesignMetrics().

WrapMode QTextOption::wrapMode () const

Returns the text wrap mode defined by the option.

See also setWrapMode().

QTextOption & QTextOption::operator= ( const QTextOption & other )

Returns true if the text option is the same as the other text option; otherwise returns false.

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 65
  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 blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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.6
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