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  ·  Fonctions  · 

QPaintDevice Class Reference

The QPaintDevice class is the base class of objects that can be painted. More...

#include <qpaintdevice.h>

Inherited by QWidget, QPixmap, QPicture, and QPrinter.

List of all member functions.

Public Members

Static Public Members

Protected Members

  • QPaintDevice ( uint devflags )
  • virtual bool cmd ( int, QPainter *, QPDevCmdParam * )

Related Functions

  • void bitBlt ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )
  • void bitBlt ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )

Detailed Description

The QPaintDevice class is the base class of objects that can be painted.

A paint device is an abstraction of a two-dimensional space that can be drawn using a QPainter. The drawing capabilities are implemented by the subclasses QWidget, QPixmap, QPicture and QPrinter.

The default coordinate system of a paint device has its origin located at the top-left position. X increases to the right and Y increases downward. The unit is one pixel. There are several ways to set up a user-defined coordinate system using the painter, for example, using QPainter::setWorldMatrix().

Example (draw on a paint device):

    void MyWidget::paintEvent( QPaintEvent * )
    {
        QPainter p;                       // our painter
        p.begin( this );                  // start painting the widget
        p.setPen( red );                  // red outline
        p.setBrush( yellow );             // yellow fill
        p.drawEllipse( 10, 20, 100,100 ); // 100x100 ellipse at position (10, 20)
        p.end();                          // painting done
    }
    

The bit block transfer is an extremely useful operation for copying pixels from one paint device to another (or to itself). It is implemented as the global function bitBlt().

Example (scroll widget contents 10 pixels to the right):

    bitBlt( myWidget, 10, 0, myWidget );
    

Warning: Qt requires that a QApplication object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.

See also Graphics Classes and Image Processing Classes.


Member Function Documentation

QPaintDevice::QPaintDevice ( uint devflags ) [protected]

Constructs a paint device with internal flags devflags. This constructor can be invoked only from QPaintDevice subclasses.

QPaintDevice::~QPaintDevice () [virtual]

Destroys the paint device and frees window system resources.

bool QPaintDevice::cmd ( int, QPainter *, QPDevCmdParam * ) [virtual protected]

Internal virtual function that interprets drawing commands from the painter.

Implemented by subclasses that have no direct support for drawing graphics (external paint devices, for example, QPicture).

Qt::HANDLE QPaintDevice::handle () const [virtual]

Returns the window system handle of the paint device, for low-level access. Using this function is not portable.

The HANDLE type varies with platform; see qpaintdevice.h and qwindowdefs.h for details.

See also x11Display().

bool QPaintDevice::isExtDev () const

Returns TRUE if the device is an external paint device; otherwise returns FALSE.

External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.

bool QPaintDevice::paintingActive () const

Returns TRUE if the device is being painted, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns FALSE.

See also QPainter::isActive().

int QPaintDevice::x11AppCells () [static]

Returns the number of entries in the colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Colormap().

int QPaintDevice::x11AppCells ( int screen ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the number of entries in the colormap for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Colormap().

Qt::HANDLE QPaintDevice::x11AppColormap () [static]

Returns the colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

Qt::HANDLE QPaintDevice::x11AppColormap ( int screen ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the colormap for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11AppDefaultColormap () [static]

Returns the default colormap for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11AppDefaultColormap ( int screen ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the default colormap for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11AppDefaultVisual () [static]

Returns TRUE if the Visual used is the default for the default screen of the X display global to the application (X11 only); otherwise returns FALSE. Using this function is not portable.

bool QPaintDevice::x11AppDefaultVisual ( int screen ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns TRUE if the Visual used is the default for screen screen of the X display global to the application (X11 only); otherwise returns FALSE. Using this function is not portable.

int QPaintDevice::x11AppDepth ( int screen ) [static]

Returns the depth for screen screen of the X display global to the application (X11 only). Using this function is not portable.

See also QPixmap::defaultDepth().

int QPaintDevice::x11AppDepth () [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the depth for the default screen of the X display global to the application (X11 only). Using this function is not portable.

See also QPixmap::defaultDepth().

Display * QPaintDevice::x11AppDisplay () [static]

Returns a pointer to the X display global to the application (X11 only). Using this function is not portable.

See also handle().

int QPaintDevice::x11AppDpiX ( int screen ) [static]

Returns the horizontal DPI of the X display (X11 only) for screen screen. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiY(), x11SetAppDpiX(), and QPaintDeviceMetrics::logicalDpiX().

int QPaintDevice::x11AppDpiX () [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the horizontal DPI of the X display (X11 only) for the default screen. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.

int QPaintDevice::x11AppDpiY ( int screen ) [static]

Returns the vertical DPI of the X11 display (X11 only) for screen screen. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiX(), x11SetAppDpiY(), and QPaintDeviceMetrics::logicalDpiY().

int QPaintDevice::x11AppDpiY () [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the vertical DPI of the X11 display (X11 only) for the default screen. Using this function is not portable. See QPaintDeviceMetrics for portable access to related information. Using this function is not portable.

See also x11AppDpiX(), x11SetAppDpiY(), and QPaintDeviceMetrics::logicalDpiY().

Qt::HANDLE QPaintDevice::x11AppRootWindow () [static]

Returns the root window for the default screen of the X display global to the applicatoin (X11 only). Using this function is not portable.

Qt::HANDLE QPaintDevice::x11AppRootWindow ( int screen ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the root window for screen screen of the X display global to the applicatoin (X11 only). Using this function is not portable.

int QPaintDevice::x11AppScreen () [static]

Returns the screen number on the X display global to the application (X11 only). Using this function is not portable.

void * QPaintDevice::x11AppVisual () [static]

Returns the Visual for the default screen of the X display global to the application (X11 only). Using this function is not portable.

void * QPaintDevice::x11AppVisual ( int screen ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the Visual for screen screen of the X display global to the application (X11 only). Using this function is not portable.

int QPaintDevice::x11Cells () const

Returns the number of entries in the colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Colormap().

Qt::HANDLE QPaintDevice::x11Colormap () const

Returns the colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11DefaultColormap () const

Returns the default colormap of the X display for the paint device (X11 only). Using this function is not portable.

See also x11Cells().

bool QPaintDevice::x11DefaultVisual () const

Returns the default Visual of the X display for the paint device (X11 only). Using this function is not portable.

int QPaintDevice::x11Depth () const

Returns the depth of the X display for the paint device (X11 only). Using this function is not portable.

See also QPixmap::defaultDepth().

Display * QPaintDevice::x11Display () const

Returns a pointer to the X display for the paint device (X11 only). Using this function is not portable.

See also handle().

int QPaintDevice::x11Screen () const

Returns the screen number on the X display for the paint device (X11 only). Using this function is not portable.

void QPaintDevice::x11SetAppDpiX ( int dpi, int screen ) [static]

Sets the value returned by x11AppDpiX() to dpi for screen screen. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.

See also x11SetAppDpiY().

void QPaintDevice::x11SetAppDpiX ( int dpi ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the value returned by x11AppDpiX() to dpi for the default screen. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.

void QPaintDevice::x11SetAppDpiY ( int dpi, int screen ) [static]

Sets the value returned by x11AppDpiY() to dpi for screen screen. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.

See also x11SetAppDpiX().

void QPaintDevice::x11SetAppDpiY ( int dpi ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the value returned by x11AppDpiY() to dpi for the default screen. The default is determined by the display configuration. Changing this value will alter the scaling of fonts and many other metrics and is not recommended. Using this function is not portable.

void * QPaintDevice::x11Visual () const

Returns the Visual of the X display for the paint device (X11 only). Using this function is not portable.


Related Functions

void bitBlt ( QPaintDevice * dst, int dx, int dy, const QPaintDevice * src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool ignoreMask )

Copies a block of pixels from src to dst, perhaps merging each pixel according to the raster operation rop. sx, sy is the top-left pixel in src (0, 0) by default, dx, dy is the top-left position in dst and sw, sh is the size of the copied block (all of src by default).

The most common values for rop are CopyROP and XorROP; the Qt::RasterOp documentation defines all the possible values.

If ignoreMask is FALSE (the default) and src is a masked QPixmap, the entire blit is masked by src->mask().

If src, dst, sw or sh is 0, bitBlt() does nothing. If sw or sh is negative bitBlt() copies starting at sx (and respectively, sy) and ending at the right end (respectively, bottom) of src.

src must be a QWidget or QPixmap. You cannot blit from a QPrinter, for example. bitBlt() does nothing if you attempt to blit from an unsupported device.

bitBlt() does nothing if src has a greater depth than dst. If you need to for example, draw a 24-bit pixmap on an 8-bit widget, you must use drawPixmap().

void bitBlt ( QPaintDevice * dst, const QPoint & dp, const QPaintDevice * src, const QRect & sr, RasterOp rop )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Overloaded bitBlt() with the destination point dp and source rectangle sr.


This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 23
  2. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 45
  3. Une nouvelle ère d'IHM 3D pour les automobiles, un concept proposé par Digia et implémenté avec Qt 3
  4. Qt Creator 2.5 est sorti en beta, l'EDI supporte maintenant plus de fonctionnalités de C++11 2
  5. PySide devient un add-on Qt et rejoint le Qt Project et le modèle d'open gouvernance 1
  6. Vingt sociétés montrent leurs décodeurs basés sur Qt au IPTV World Forum, en en exploitant diverses facettes (déclaratif, Web, widgets) 0
  7. Thread travailleur avec Qt en utilisant les signaux et les slots, un article de Christophe Dumez traduit par Thibaut Cuvelier 1
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 50
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 23
  5. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 45
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

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