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  · 

QDirectPainter Class Reference

The QDirectPainter class provides direct access to the video hardware. More...

#include <qdirectpainter_qws.h>

Inherits QPainter.

List of all member functions.

Public Members


Detailed Description

The QDirectPainter class provides direct access to the video hardware.

Only available in Qt/Embedded.

When the hardware is known and well defined, as is often the case with software for embedded devices, it may be useful to manipulate the underlying video hardware directly. In order to do this in a way that is co-operative with other applications, you must lock the video hardware for exclusive use for a small time while you write to it, and you must know the clipping region which is allocated to a widget.

QDirectPainter provides this functionality.

In the simplest case, you make a QDirectPainter on a widget and then, observing the clip region, perform some platform-specific operation. For example:

        void MyWidget::updatePlatformGraphics()
        {
            QDirectPainter dp( this );
            for ( int i = 0; i < dp.numRects; i++ ) {
                const QRect& clip = dp.rect(i);
                ... // platform specific operation
            }
        }
    

The platform-specific code has access to the display, but should only modify graphics in the rectangles specified by numRects() and rect(). Note that these rectangles are relative to the entire display.

The offset() function returns the position of the widget relative to the entire display, allowing you to offset platform-specific operations appropriately. The xOffset() and yOffset() functions merely return the component values of offset().

For simple frame-buffer hardware, the frameBuffer(), lineStep(), and depth() functions provide basic access, though some hardware configurations are insufficiently specified by such simple parameters.

Note that while a QDirectPainter exists, the entire Qt/Embedded window system is locked from use by other applications. Always construct the QDirectPainter as an auto (stack) variable, and be very careful to write robust and stable code within its scope.

See also Graphics Classes.


Member Function Documentation

QDirectPainter::QDirectPainter ( const QWidget * w )

Construct a direct painter on w. The display is locked and the mouse cursor is hidden if it is above w.

QDirectPainter::~QDirectPainter ()

Destroys the direct painter. The mouse cursor is revealed if necessary and the display is unlocked.

int QDirectPainter::depth () const

Returns the bit-depth of the display.

uchar * QDirectPainter::frameBuffer ()

Returns a pointer to the framebuffer memory if available.

int QDirectPainter::height () const

Returns the height of the widget drawn upon.

int QDirectPainter::lineStep ()

Returns the spacing in bytes from one framebuffer line to the next.

int QDirectPainter::numRects () const

Returns the number of rectangles in the drawable region.

See also rect() and region().

QPoint QDirectPainter::offset () const

Returns the position of the widget relative to the entire display.

const QRect & QDirectPainter::rect ( int i ) const

Returns a reference to rectangle i of the drawable region. Valid values for i are 0..numRects()-1.

See also region().

QRegion QDirectPainter::region () const

Returns the region of the framebuffer which represents the exposed area of the widget being painted on. Note that this may be a sub-area of the clip region, because of child widgets and overlapping cousin widgets.

See also numRects() and rect().

void QDirectPainter::setAreaChanged ( const QRect & r )

Sets the area changed by the transaction to r. By default, the entire widget is assumed to have changed. The area changed is only used by some graphics drivers, so often calling this function for a smaller area will make no difference to performance.

QSize QDirectPainter::size () const

Returns the size of the widget drawn upon.

See also width() and height().

int QDirectPainter::transformOrientation ()

Returns a number that signifies the orientation of the framebuffer.
0 no rotation
1 90 degrees rotation
2 180 degrees rotation
3 270 degrees rotation

int QDirectPainter::width () const

Returns the width of the widget drawn upon.

int QDirectPainter::xOffset () const

Returns the X-position of the widget relative to the entire display.

int QDirectPainter::yOffset () const

Returns the Y-position of the widget relative to the entire display.

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

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 Qt Developer Network au hasard

Logo

Applications mobiles modernes avec Qt et 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 3.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