QtBase
v6.3.1
|
The QColorDialog class provides a dialog widget for specifying colors. More...
#include <qcolordialog.h>
Public Types | |
enum | ColorDialogOption { ShowAlphaChannel = 0x00000001 , NoButtons = 0x00000002 , DontUseNativeDialog = 0x00000004 } |
Public Types inherited from QDialog | |
enum | DialogCode { Rejected , Accepted } |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Slots | |
virtual void | open () |
Public Slots inherited from QDialog | |
virtual void | open () |
virtual int | exec () |
virtual void | accept () |
virtual void | reject () |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | currentColorChanged (const QColor &color) |
void | colorSelected (const QColor &color) |
Signals inherited from QDialog | |
void | finished (int result) |
void | accepted () |
void | rejected () |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
QColor | currentColor |
the currently selected color in the dialog More... | |
ColorDialogOptions | options |
the various options that affect the look and feel of the dialog More... | |
Properties inherited from QDialog | |
bool | sizeGripEnabled |
whether the size grip is enabled More... | |
bool | modal |
whether show() should pop up the dialog as modal or modeless More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Additional Inherited Members | |
Protected Slots inherited from QWidget | |
void | updateMicroFocus (Qt::InputMethodQuery query=Qt::ImQueryAll) |
Protected Attributes inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Protected Attributes inherited from QPaintDevice | |
ushort | painters |
Related Functions inherited from QWidget | |
setupUi (QWidget *widget) | |
Related Functions inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
The QColorDialog class provides a dialog widget for specifying colors.
\inmodule QtWidgets
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. \omit If you require a modeless dialog, use the QColorDialog constructor. \endomit
The static getColor() function shows the dialog, and allows the user to specify a color. This function can also be used to let users choose a color with a level of transparency: pass the ShowAlphaChannel option as an additional argument.
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.
When pressing the "Pick Screen Color" button, the cursor changes to a haircross and the colors on the screen are scanned. The user can pick up one by clicking the mouse or the Enter button. Pressing Escape restores the last color selected before entering this mode.
The \l{dialogs/standarddialogs}{Standard Dialogs} example shows how to use QColorDialog as well as other built-in Qt dialogs.
A color dialog in the Fusion widget style.
Definition at line 53 of file qcolordialog.h.
This enum specifies various options that affect the look and feel of a color dialog.
\value ShowAlphaChannel Allow the user to select the alpha component of a color. \value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".) \value DontUseNativeDialog Use Qt's standard color dialog instead of the operating system native color dialog.
Enumerator | |
---|---|
ShowAlphaChannel | |
NoButtons | |
DontUseNativeDialog |
Definition at line 62 of file qcolordialog.h.
Constructs a color dialog with the given parent.
Definition at line 1943 of file qcolordialog.cpp.
Constructs a color dialog with the given parent and specified initial color.
Definition at line 1954 of file qcolordialog.cpp.
QColorDialog::~QColorDialog | ( | ) |
Destroys the color dialog.
Definition at line 2176 of file qcolordialog.cpp.
\reimp
Reimplemented from QWidget.
Definition at line 2184 of file qcolordialog.cpp.
This signal is emitted just after the user has clicked \uicontrol{OK} to select a color to use. The chosen color is specified by color.
QColor QColorDialog::currentColor | ( | ) | const |
Definition at line 1987 of file qcolordialog.cpp.
This signal is emitted whenever the current color changes in the dialog. The current color is specified by color.
|
static |
Returns the custom color at the given index as a QColor value.
Definition at line 541 of file qcolordialog.cpp.
|
static |
Returns the number of custom colors supported by QColorDialog. All color dialogs share the same custom colors.
Definition at line 531 of file qcolordialog.cpp.
|
overrideprotectedvirtual |
Closes the dialog and sets its result code to result. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return result.
Reimplemented from QDialog.
Definition at line 2261 of file qcolordialog.cpp.
|
static |
Pops up a modal color dialog with the given window title (or "Select Color" if none is specified), 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.
The options argument allows you to customize the dialog.
Definition at line 2160 of file qcolordialog.cpp.
|
slot |
Shows the dialog as a \l{QDialog::Modal Dialogs}{window modal dialog}, returning immediately.
Definition at line 87 of file qdialog.cpp.
Opens the dialog and connects its colorSelected() signal to the slot specified by receiver and member.
The signal will be disconnected from the slot when the dialog is closed.
Definition at line 2141 of file qcolordialog.cpp.
QColorDialog::ColorDialogOptions QColorDialog::options | ( | ) | const |
QColor QColorDialog::selectedColor | ( | ) | const |
Returns the color that the user selected by clicking the \uicontrol{OK} or equivalent button.
Definition at line 2001 of file qcolordialog.cpp.
Definition at line 1981 of file qcolordialog.cpp.
Sets the custom color at index to the QColor color value.
Definition at line 553 of file qcolordialog.cpp.
void QColorDialog::setOption | ( | ColorDialogOption | option, |
bool | on = true |
||
) |
Sets the given option to be enabled if on is true; otherwise, clears the given option.
Definition at line 2013 of file qcolordialog.cpp.
void QColorDialog::setOptions | ( | ColorDialogOptions | options | ) |
Sets the standard color at index to the QColor color value.
Definition at line 575 of file qcolordialog.cpp.
|
overridevirtual |
Changes the visibility of the dialog. If visible is true, the dialog is shown; otherwise, it is hidden.
Reimplemented from QWidget.
Definition at line 2108 of file qcolordialog.cpp.
|
static |
Returns the standard color at the given index as a QColor value.
Definition at line 563 of file qcolordialog.cpp.
bool QColorDialog::testOption | ( | ColorDialogOption | option | ) | const |
Returns true
if the given option is enabled; otherwise, returns false.
Definition at line 2028 of file qcolordialog.cpp.
|
readwrite |
the currently selected color in the dialog
Definition at line 124 of file qcolordialog.h.
|
readwrite |
the various options that affect the look and feel of the dialog
By default, all options are disabled.
Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).
Definition at line 124 of file qcolordialog.h.