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  · 

QColorDialog Class Reference
[QtGui module]

The QColorDialog class provides a dialog widget for specifying colors. More...

 #include <QColorDialog>

Inherits QDialog.

Static Public Members

  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject

Additional Inherited Members

  • 2 properties inherited from QDialog
  • 57 properties inherited from QWidget
  • 1 property inherited from QObject
  • 5 public functions inherited from QDialog
  • 206 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 12 public functions inherited from QPaintDevice
  • 4 public slots inherited from QDialog
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 3 signals inherited from QDialog
  • 1 signal inherited from QWidget
  • 1 signal inherited from QObject
  • 38 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget

Detailed Description

The QColorDialog class provides a dialog widget for specifying colors.

The color dialog's function is to allow users to choose colors. For example, you might use this in a drawing program to allow the user to set the brush color.

The static functions provide modal color dialogs.

The static getColor() function shows the dialog, and allows the user to specify a color. The getRgba() function does the same, but also allows the user to specify a color with an alpha channel (transparency) value.

The user can store customCount() different custom colors. The custom colors are shared by all color dialogs, and remembered during the execution of the program. Use setCustomColor() to set the custom colors, and use customColor() to get them.

Additional widgets that allow users to pick colors are available as Qt Solutions.

The Standard Dialogs example shows how to use QColorDialog as well as other built-in Qt dialogs.

A color dialog in the Plastique widget style.

See also QColor, QFileDialog, QPrintDialog, QFontDialog, and Standard Dialogs Example.


Member Function Documentation

QRgb QColorDialog::customColor ( int i )   [static]

Returns custom color number i as a QRgb value.

See also setCustomColor().

int QColorDialog::customCount ()   [static]

Returns the number of custom colors supported by QColorDialog. All color dialogs share the same custom colors.

QColor QColorDialog::getColor ( const QColor & initial = Qt::white, QWidget * parent = 0 )   [static]

Pops up a modal color dialog, lets the user choose a color, and returns that color. The color is initially set to initial. The dialog is a child of parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog. All colors allocated by the dialog will be deallocated before this function returns.

QRgb QColorDialog::getRgba ( QRgb initial = 0xffffffff, bool * ok = 0, QWidget * parent = 0 )   [static]

Pops up a modal color dialog to allow the user to choose a color and an alpha channel (transparency) value. The color+alpha is initially set to initial. The dialog is a child of parent.

If ok is non-null, *a ok is set to true if the user clicked OK, and to false if the user clicked Cancel.

If the user clicks Cancel, the initial value is returned.

void QColorDialog::setCustomColor ( int number, QRgb color )   [static]

Sets the custom color number to the QRgb color value.

See also customColor().

void QColorDialog::setStandardColor ( int number, QRgb color )   [static]

Sets the standard color number to the QRgb color value given.

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 44
  2. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. 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
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
Page suivante

Le Qt Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

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