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

QWSWindowSurface Class Reference
[QtGui module]

The QWSWindowSurface class provides the drawing area for top-level windows in Qtopia Core. More...

 #include <QWSWindowSurface>

This class is under development and is subject to change.

This class was introduced in Qt 4.2.

Public Types

Public Functions

Protected Functions


Detailed Description

The QWSWindowSurface class provides the drawing area for top-level windows in Qtopia Core.

Note that this class is only available in Qtopia Core.

In Qtopia Core, the default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen. QWSWindowSurface is used by the window system to implement the associated memory allocation.

When a screen update is required, the server runs through all the top-level windows that intersect with the region that is about to be updated, and ensures that the associated clients have updated their memory buffer. Then the server uses the screen driver to copy the content of the memory to the screen. To locate the relevant parts of memory, the driver is provided with the list of top-level windows that intersect with the given region. Associated with each of the top-level windows there is a window surface representing the drawing area of the window.

When deriving from the QWSWindowSurface class, e.g., when adding an accelerated graphics driver, there are several pure virtual functions that must be implemented. In addition, QWSWindowSurface provides several virtual functions that can be reimplemented to customize the drawing process.

Pure Virtual Functions

There are in fact two window surface instances for each top-level window; one used by the application when drawing a window, and another used by the server application to perform window compositioning. Implement the attach() to create the server-side representation of the surface. The data() function must be implemented to provide the required data. In addition, the related detach() function must be implemented to enable the window system to detach the server-side instance from the client.

Implement the key() function to uniquely identify the surface class, and the isValidFor() function to determine is a surface corresponds to a given widget.

The geometry() function must be implemented to let the window system determine the area required by the window surface (QWSWindowSurface also provides a corresponding virtual setGeometry() function that is called whenever the area necessary for the top-level window to be drawn, changes). The image() function is called by the window system during window compositioning, and must be implemented to return an image of the top-level window.

Finally, the paintDevice() function must be implemented to return the appropriate paint device, and the scroll() function must be implemented to scroll the given region of the surface the given number of pixels.

Virtual Functions

When painting onto the surface, the window system will always call the beginPaint() function before any painting operations are performed. Likewise the endPaint() function is automatically called when the painting is done. Reimplement the painterOffset() function to alter the offset that is applied when drawing.

The window system uses the flush() function to put a given region of the widget onto the screen, and the release() function to deallocate the screen region corresponding to this window surface.

Other Members

QWSWindowSurface provides the window() function returning a pointer to the top-level window the surface is representing. The currently visible region of the associated widget can be retrieved and set using the clipRegion() and setClipRegion() functions, respectively.

When the window system performs the window compositioning, it uses the SurfaceFlag enum describing the surface content. The currently set surface flags can be retrieved and altered using the surfaceFlags() and setSurfaceFlags() functions. In addition, QWSWindowSurface provides the isBuffered(), isOpaque() and isReserved() convenience functions. Use the dirtyRegion() function to retrieve the part of the widget that must be repainted, and the setDirty() function to ensure that a region is repainted.

See also Qtopia Core Architecture.


Member Type Documentation

enum QWSWindowSurface::SurfaceFlag
flags QWSWindowSurface::SurfaceFlags

This enum is used to describe the window surface's contents. It is used by the screen driver to handle region allocation and composition.

ConstantValueDescription
QWSWindowSurface::Reserved0x1The surface contains a reserved area. Once allocated, a reserved area can not not be changed by the window system, i.e., no other widgets can be drawn on top of this.
QWSWindowSurface::Buffered0x2The surface is in a memory area which is not part of a framebuffer. (A top-level window with QWidget::windowOpacity() other than 1.0 must use a buffered surface in order to making blending with the background work.)
QWSWindowSurface::Opaque0x4The surface contains only opaque pixels.

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

See also surfaceFlags() and setSurfaceFlags().


Member Function Documentation

QWSWindowSurface::QWSWindowSurface ()

Constructs an empty surface.

QWSWindowSurface::QWSWindowSurface ( QWidget * window )

Constructs an empty surface for the given top-level window.

QWSWindowSurface::~QWSWindowSurface ()

Destroys this surface.

bool QWSWindowSurface::attach ( const QByteArray & data )   [pure virtual]

Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data. Return true if successful; otherwise return false.

See also detach() and data().

void QWSWindowSurface::beginPaint ( const QRegion & region )   [virtual]

This function is called before painting onto the surface begins, with the region in which the painting will occur.

See also endPaint() and paintDevice().

const QRegion QWSWindowSurface::clipRegion () const

Returns the region currently visible on the screen.

See also setClipRegion().

const QByteArray QWSWindowSurface::data () const   [pure virtual]

Implement this function to return the data required for creating a server-side representation of the surface.

See also attach().

void QWSWindowSurface::detach ()   [pure virtual]

Implement this function to detach a server-side instance from the client.

See also attach() and release().

const QRegion QWSWindowSurface::dirtyRegion () const

Returns the region that must be repainted.

See also setDirty().

void QWSWindowSurface::endPaint ( const QRegion & region )   [virtual]

This function is called after painting onto the surface has ended, with the region in which the painting was performed.

See also beginPaint() and paintDevice().

void QWSWindowSurface::flush ( QWidget * widget, const QRegion & region, const QPoint & offset )   [virtual]

Flushes the given region from the specified widget onto the screen.

Note that the offset parameter is currently unused.

See also painterOffset().

QRect QWSWindowSurface::geometry () const   [pure virtual]

Implement this function to return the currently allocated area.

See also setGeometry(), scroll(), and image().

const QImage QWSWindowSurface::image () const   [pure virtual]

Implement this function to return an image of the top-level window.

See also geometry().

bool QWSWindowSurface::isBuffered () const

Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.

See also surfaceFlags().

bool QWSWindowSurface::isOpaque () const

Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false.

See also surfaceFlags().

bool QWSWindowSurface::isReserved () const

Returns true if the QWSWindowSurface::Reserved is set; otherwise returns false.

See also surfaceFlags().

bool QWSWindowSurface::isValidFor ( const QWidget * window ) const   [pure virtual]

Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false.

See also window() and key().

const QString QWSWindowSurface::key () const   [pure virtual]

Implement this function to return a string that uniquely identifies the class of this surface.

See also window() and isValidFor().

QPaintDevice * QWSWindowSurface::paintDevice ()   [pure virtual]

Implement this function to return the appropriate paint device.

See also painterOffset().

QPoint QWSWindowSurface::painterOffset () const   [virtual]

Returns the offset to be used when painting.

See also paintDevice().

void QWSWindowSurface::release ()   [virtual]

Releases the current allocated screen region associated with this window surface.

See also detach().

void QWSWindowSurface::scroll ( const QRegion & region, int dx, int dy )   [pure virtual]

Scrolls the given region dx pixels to the right and dy downward; both dx and dy may be negative.

See also geometry().

void QWSWindowSurface::setClipRegion ( const QRegion & clip )

Sets the region currently visible on the screen to be the given clip region.

See also clipRegion().

void QWSWindowSurface::setDirty ( const QRegion & region ) const

Marks the given region as dirty, i.e., altered.

See also dirtyRegion().

void QWSWindowSurface::setGeometry ( const QRect & rectangle )   [virtual]

Sets the currently allocated area to be the given rectangle.

This function is called whenever area covered by the top-level window changes.

See also geometry().

void QWSWindowSurface::setSurfaceFlags ( SurfaceFlags flags )   [protected]

Sets the surface flags describing the contents of this surface, to be the given flags.

See also surfaceFlags().

SurfaceFlags QWSWindowSurface::surfaceFlags () const

Returns the surface flags describing the contents of this surface.

See also setSurfaceFlags(), isBuffered(), isOpaque(), and isReserved().

QWidget * QWSWindowSurface::window () const

Returns a pointer to the top-level window associated with this surface.

See also isValidFor() and key().

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 64
  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

Comment fermer une application

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