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  · 

Q3Painter Class Reference
[Qt3Support module]

The Q3Painter class is a Qt 3 compatibility wrapper for QPainter. More...

 #include <Q3Painter>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits QPainter.

Public Functions

  • Q3Painter ( QPaintDevice * pdev )
  • void drawArc ( const QRect & r, int a, int alen )
  • void drawArc ( int x, int y, int w, int h, int startAngle, int spanAngle )
  • void drawChord ( const QRect & r, int a, int alen )
  • void drawChord ( int x, int y, int w, int h, int startAngle, int spanAngle )
  • void drawEllipse ( const QRect & r )
  • void drawEllipse ( int x, int y, int width, int height )
  • void drawPie ( const QRect & r, int a, int alen )
  • void drawPie ( int x, int y, int w, int h, int startAngle, int spanAngle )
  • void drawRect ( const QRect & r )
  • void drawRect ( int x, int y, int w, int h )
  • void drawRoundRect ( const QRect & r, int xrnd = 25, int yrnd = 25 )
  • void drawRoundRect ( int x, int y, int w, int h, int xrnd = 25, int yrnd = 25 )
  • 174 public functions inherited from QPainter

Additional Inherited Members

  • 3 static public members inherited from QPainter

Detailed Description

The Q3Painter class is a Qt 3 compatibility wrapper for QPainter.

Prior to Qt 4, QPainter specialized the pen drawing for rectangle based functions (in particular: drawRect, drawEllipse, drawRoundRect, drawArc, drawChord and drawPie). When stroking a rectangle of width 10, the pen would draw a rectangle of width 10. Drawing a polygon defined by the corner points of the same rectangle the stroke would have a width of 11.

The reason for this is best explained using the picture below:

As we can see, stroking the rectangle so it gets a width of 10, means the pen is drawn on a rectangle on width 9. The polygon, however follows a consistent model.

In Qt 4, all rectangle based functions have changed to follow the polygon approach, which means that the rectangle defines the size of the fill, and the pen follows the edges of the shape. For pen widths of 0 and 1 this means that the stroke will be inside the shape on the left and the top and outside on the bottom and right.

The reason for the change in Qt 4 is so that we provide consistency for all drawing functions even with complex transformations.


Member Function Documentation

Q3Painter::Q3Painter ()

Constructs a Q3Painter.

Q3Painter::Q3Painter ( QPaintDevice * pdev )

Constructs a Q3Painter that operates on device pdev.

void Q3Painter::drawArc ( const QRect & r, int a, int alen )

Draws an arc defined by the rectangle r, the start angle a and the arc length alen.

The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

Example:

 QPainter p(myWidget);
 p.drawArc(QRect(10,10, 70,100), 100*16, 160*16); // draws a "(" arc

See also drawPie() and drawChord().

void Q3Painter::drawArc ( int x, int y, int w, int h, int startAngle, int spanAngle )

This is an overloaded member function, provided for convenience.

Draws the arc that fits inside the rectangle (x, y, w, h), with the given startAngle and spanAngle.

void Q3Painter::drawChord ( const QRect & r, int a, int alen )

Draws a chord defined by the rectangle r, the start angle a and the arc length alen.

The chord is filled with the current brush().

The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

See also drawArc() and drawPie().

void Q3Painter::drawChord ( int x, int y, int w, int h, int startAngle, int spanAngle )

This is an overloaded member function, provided for convenience.

Draws a chord that fits inside the rectangle (x, y, w, h) with the given startAngle and spanAngle.

void Q3Painter::drawEllipse ( const QRect & r )

Draws the ellipse that fits inside the bounds r using the current pen and brush.

void Q3Painter::drawEllipse ( int x, int y, int width, int height )

This is an overloaded member function, provided for convenience.

Draws an ellipse that fits inside the bounds specified by x, y, width and height using the current pen and brush.

void Q3Painter::drawPie ( const QRect & r, int a, int alen )

Draws a pie defined by the rectangle r, the start angle a and the arc length alen.

The pie is filled with the current brush().

The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

See also drawArc() and drawChord().

void Q3Painter::drawPie ( int x, int y, int w, int h, int startAngle, int spanAngle )

This is an overloaded member function, provided for convenience.

Draws a pie segment that fits inside the bounds (x, y, w, h) with the given startAngle and spanAngle.

void Q3Painter::drawRect ( const QRect & r )

Draws a rectangle that fits inside the rectangle r using the current pen and brush.

void Q3Painter::drawRect ( int x, int y, int w, int h )

This is an overloaded member function, provided for convenience.

Draws the rectangle that fits inside the bounds specified by x, y, w and h using the current pen and brush.

void Q3Painter::drawRoundRect ( const QRect & r, int xrnd = 25, int yrnd = 25 )

Draws a rounded rect that fits into the bounds r using the current pen and brush. The parameters xrnd and yrnd specifies the roundness in x and y direction.

void Q3Painter::drawRoundRect ( int x, int y, int w, int h, int xrnd = 25, int yrnd = 25 )

This is an overloaded member function, provided for convenience.

Draws a rounded rect that fits into the bounds x, y, w and h using the current pen and brush. The parameters xrnd and yrnd specifies the roundness in x and y direction.

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 82
  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. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Developer Network au hasard

Logo

La création de colonnes dans une ListView en QML

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