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  · 

QDecoration Class Reference
[QtGui module]

The QDecoration class allows the appearance of top level windows to be customized. More...

#include <QDecoration>

Public Types

Public Functions

  • virtual ~QDecoration ()
  • virtual void buildSysMenu ( QWidget * widget, QMenu * menu )
  • void menuTriggered ( QWidget * widget, QAction * action )
  • virtual bool paint ( QPainter * painter, const QWidget * widget, int decorationRegion = All, DecorationState state = Normal ) = 0
  • virtual QRegion region ( const QWidget * widget, const QRect & rectangle, int decorationRegion = All ) = 0
  • QRegion region ( const QWidget * widget, int decorationRegion = All )
  • virtual int regionAt ( const QWidget * widget, const QPoint & point )
  • virtual void regionClicked ( QWidget * widget, int region )
  • virtual void regionDoubleClicked ( QWidget * widget, int region )

Static Public Members


Detailed Description

The QDecoration class allows the appearance of top level windows to be customized.

Note that this class is non-portable, and that it is only available in Qtopia Core.

Qtopia Core provides window management of top level windows. The appearance of the borders and buttons (the decoration) around these windows can be customized by deriving from the QDecoration class. Custom decorations can be added by subclassing the QDecorationPlugin class, using the QDecorationFactory class to dynamically load the decoration into the application. To actually apply a decoration to an application, use the QApplication::qwsSetDecoration() function.

The QDecoration class provides the virtual paint() function that can be reimplemented to paint the border and title decoration around a specified widget using a given painter and decoration state.

The DecorationRegion enum is used to specify which region to paint. This enum describes the various regions of the window decoration. The region() function is used to retrieve the actual regions the decoration occupy. It is also possible to determine the type of region containing a given point, using the regionAt() function. The DecorationState enum is used to specify a region's state, e.g. whether it is active or not.

QDecoration also provides the possibility of building the system menu for a given top level widget with its virtual buildSysMenu() function. The menuTriggered() function is called whenever an action in such a widget's menu is triggered.

The virtual regionClicked() and regionDoubleClicked() functions are provided to enable response to mouse clicks. The default implementations responds to (single) clicks on items in a widget's system menu and double clicks on a widget's title.

Finally, the QDecoration class provides a couple of static functions, startMove() and startResize(), which start the move or resize action by making the appropiate decoration region active and grabbing the mouse input.

See also QDecorationFactory, QDecorationPlugin, and QDirectPainter.


Member Type Documentation

enum QDecoration::DecorationRegion

This enum describes the various regions of the window decoration.

ConstantValueDescription
QDecoration::All0x7fffffffThe entire region used by the window decoration.
QDecoration::Top0x0000000002The top border used to vertically resize the window.
QDecoration::Bottom0x0000000040The bottom border used to vertically resize the window.
QDecoration::Left0x0000000008The left border used to horizontally resize the window.
QDecoration::Right0x0000000010The right border used to horizontally resize the window.
QDecoration::TopLeft0x0000000001The top-left corner of the window used to resize the window both horizontally and vertically.
QDecoration::TopRight0x0000000004The top-right corner of the window used to resize the window both horizontally and vertically.
QDecoration::BottomLeft0x0000000020The bottom-left corner of the window used to resize the window both horizontally and vertically.
QDecoration::BottomRight0x0000000080The bottom-right corner of the window used to resize the window both horizontally and vertically.
QDecoration::Borders0x00000000ffAll the regions used to describe the window border.
QDecoration::Title0x0000000200The region containing the window title, used to move the window by dragging with the mouse cursor.
QDecoration::Close0x0000004000The region occupied by the close button. Clicking in this region closes the window.
QDecoration::Minimize0x0000000800The region occupied by the minimize button. Clicking in this region minimizes the window.
QDecoration::Maximize0x0000001000The region occupied by the maximize button. Clicking in this region maximizes the window.
QDecoration::Normalize0x0000002000The region occupied by a button used to restore a window's normal size. Clicking in this region restores a maximized window to its previous size. The region used for this button is often also the Maximize region.
QDecoration::Menu0x0000000100The region occupied by the window's menu button. Clicking in this region opens the window operations (system) menu.
QDecoration::Help0x0000000400The region occupied by the window's help button. Clicking in this region causes the context-sensitive help function to be enabled.
QDecoration::Resize0x0000010000The region used to resize the window.
QDecoration::Move0x0000008000The region used to move the window.
QDecoration::None0x0000000000No region.

See also region(), regionAt(), and DecorationState.

enum QDecoration::DecorationState

This enum describes the various states of a decoration region.

ConstantValueDescription
QDecoration::Normal0x04The region is active
QDecoration::Disabled0x08The region is inactive.
QDecoration::Hover0x01The cursor is hovering over the region.
QDecoration::Pressed0x02The region is pressed.

See also paint() and DecorationRegion.


Member Function Documentation

QDecoration::QDecoration ()

Constructs a decoration object.

QDecoration::~QDecoration ()   [virtual]

Destroys this decoration object.

void QDecoration::buildSysMenu ( QWidget * widget, QMenu * menu )   [virtual]

Builds the system menu for the given top level widget.

See also menuTriggered().

void QDecoration::menuTriggered ( QWidget * widget, QAction * action )

This function is called whenever an action in a top level widget's menu is triggered. Pointers to the widget and action are passed as arguments.

See also buildSysMenu().

bool QDecoration::paint ( QPainter * painter, const QWidget * widget, int decorationRegion = All, DecorationState state = Normal )   [pure virtual]

This virtual function allows subclasses of QDecoration to paint the border and title decoration for the specified top level widget using the given painter and state.

The specified decorationRegion is a bitmask of the values described by the DecorationRegion enum.

QRegion QDecoration::region ( const QWidget * widget, const QRect & rectangle, int decorationRegion = All )   [pure virtual]

Returns the region specified by decorationRegion, for the given top level widget.

The rectangle parameter specifies the rectangle the decoration is wrapped around. The decorationRegion is a bitmask of the values described by the DecorationRegion enum.

See also regionAt().

QRegion QDecoration::region ( const QWidget * widget, int decorationRegion = All )

This is an overloaded member function, provided for convenience.

Returns the region specified by decorationRegion containing the given widget. The decorationRegion is a bitmask of the values described by the DecorationRegion enum.

int QDecoration::regionAt ( const QWidget * widget, const QPoint & point )   [virtual]

Returns the type of the first region of the specified top level widget containing the given point.

The return value is one of the DecorationRegion enum's values. Use the region() function to retrieve the actual region. If none of the widget's regions contain the point, this function returns None.

See also region().

void QDecoration::regionClicked ( QWidget * widget, int region )   [virtual]

This function is called whenever a region in a top level widget is clicked. The parameters specifies the widget as well as the region. Note that the region parameter is one of the DecorationRegion values.

The default implementation responds to clicks on items in the system menu, performing the requested actions.

See also regionDoubleClicked().

void QDecoration::regionDoubleClicked ( QWidget * widget, int region )   [virtual]

This function is called whenever a region in a top level widget is double clicked. The parameters specifies the widget as well as the region. Note that the region parameter is one of the DecorationRegion values.

The default implementation responds to a double click on the widget's title, toggling its size between the maximum and its normal size.

See also regionClicked().

void QDecoration::startMove ( QWidget * widget )   [static]

Starts to move the given widget by making its Title region active and grabbing the mouse input. The widget must be a top level widget.

See also DecorationRegion.

void QDecoration::startResize ( QWidget * widget )   [static]

Starts to resize the given widget by making its BottomRight region active and grabbing the mouse input. The widget must be a top level widget.

See also DecorationRegion.

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 Quarterly au hasard

Logo

Abusons de QMap

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