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  ·  Tous les espaces de nom  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QPainterPathStroker Class Reference
[QtGui module]

The QPainterPathStroker class is used to generate fillable outlines for a given painter path. More...

 #include <QPainterPathStroker>

This class was introduced in Qt 4.1.

Public Functions


Detailed Description

The QPainterPathStroker class is used to generate fillable outlines for a given painter path.

By calling the createStroke() function, passing a given QPainterPath as argument, a new painter path representing the outline of the given path is created. The newly created painter path can then be filled to draw the original painter path's outline.

You can control the various design aspects (width, cap styles, join styles and dash pattern) of the outlining using the following functions:

The setDashPattern() function accepts both a Qt::PenStyle object and a vector representation of the pattern as argument.

In addition you can specify a curve's threshold, controlling the granularity with which a curve is drawn, using the setCurveThreshold() function. The default threshold is a well adjusted value (0.25), and normally you should not need to modify it. However, you can make the curve's appearance smoother by decreasing its value.

You can also control the miter limit for the generated outline using the setMiterLimit() function. The miter limit describes how far from each join the miter join can extend. The limit is specified in the units of width so the pixelwise miter limit will be miterlimit * width. This value is only used if the join style is Qt::MiterJoin.

The painter path generated by the createStroke() function should only be used for outlining the given painter path. Otherwise it may cause unexpected behavior. Generated outlines also require the Qt::WindingFill rule which is set by default.

See also QPen and QBrush.


Member Function Documentation

QPainterPathStroker::QPainterPathStroker ()

Creates a new stroker.

QPainterPathStroker::~QPainterPathStroker ()

Destroys the stroker.

Qt::PenCapStyle QPainterPathStroker::capStyle () const

Returns the cap style of the generated outlines.

See also setCapStyle().

QPainterPath QPainterPathStroker::createStroke ( const QPainterPath & path ) const

Generates a new path that is a fillable area representing the outline of the given path.

The various design aspects of the outline are based on the stroker's properties: width(), capStyle(), joinStyle(), dashPattern(), curveThreshold() and miterLimit().

The generated path should only be used for outlining the given painter path. Otherwise it may cause unexpected behavior. Generated outlines also require the Qt::WindingFill rule which is set by default.

qreal QPainterPathStroker::curveThreshold () const

Returns the curve flattening threshold for the generated outlines.

See also setCurveThreshold().

qreal QPainterPathStroker::dashOffset () const

Returns the dash offset for the generated outlines.

See also setDashOffset().

QVector<qreal> QPainterPathStroker::dashPattern () const

Returns the dash pattern for the generated outlines.

See also setDashPattern().

Qt::PenJoinStyle QPainterPathStroker::joinStyle () const

Returns the join style of the generated outlines.

See also setJoinStyle().

qreal QPainterPathStroker::miterLimit () const

Returns the miter limit for the generated outlines.

See also setMiterLimit().

void QPainterPathStroker::setCapStyle ( Qt::PenCapStyle style )

Sets the cap style of the generated outlines to style. If a dash pattern is set, each segment of the pattern is subject to the cap style.

See also capStyle().

void QPainterPathStroker::setCurveThreshold ( qreal threshold )

Specifies the curve flattening threshold, controlling the granularity with which the generated outlines' curve is drawn.

The default threshold is a well adjusted value (0.25), and normally you should not need to modify it. However, you can make the curve's appearance smoother by decreasing its value.

See also curveThreshold().

void QPainterPathStroker::setDashOffset ( qreal offset )

Sets the dash offset for the generated outlines to offset.

See also dashOffset().

void QPainterPathStroker::setDashPattern ( Qt::PenStyle style )

Sets the dash pattern for the generated outlines to style.

See also dashPattern().

void QPainterPathStroker::setDashPattern ( const QVector<qreal> & dashPattern )

This is an overloaded member function, provided for convenience.

Sets the dash pattern for the generated outlines to dashPattern. This function makes it possible to specify custom dash patterns.

Each element in the vector contains the lengths of the dashes and spaces in the stroke, beginning with the first dash in the first element, the first space in the second element, and alternating between dashes and spaces for each following pair of elements.

The vector can contain an odd number of elements, in which case the last element will be extended by the length of the first element when the pattern repeats.

void QPainterPathStroker::setJoinStyle ( Qt::PenJoinStyle style )

Sets the join style of the generated outlines to style.

See also joinStyle().

void QPainterPathStroker::setMiterLimit ( qreal limit )

Sets the miter limit of the generated outlines to limit.

The miter limit describes how far from each join the miter join can extend. The limit is specified in units of the currently set width. So the pixelwise miter limit will be miterlimit * width.

This value is only used if the join style is Qt::MiterJoin.

See also miterLimit().

void QPainterPathStroker::setWidth ( qreal width )

Sets the width of the generated outline painter path to width.

The generated outlines will extend approximately 50% of width to each side of the given input path's original outline.

See also width().

qreal QPainterPathStroker::width () const

Returns the width of the generated outlines.

See also setWidth().

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 54
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  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 Quarterly au hasard

Logo

FAQ sur l'internationalisation

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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.4
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