File: qcolordialog.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (83 lines) | stat: -rw-r--r-- 17,558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QColorDialog Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QColorDialog Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QColorDialog class provides a dialog widget for specifying colors. <a href="#details">More...</a></p>
<p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qcolordialog.html#ColorDialogOption-enum">ColorDialogOption</a></b> { ShowAlphaChannel, NoButtons, DontUseNativeDialog }</li><li><div class="fn" />class <b><a href="qcolordialog-colordialogoptions.html">ColorDialogOptions</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcolordialog.html#QColorDialog">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qcolordialog.html#QColorDialog-2">__init__</a></b> (<i>self</i>, QColor, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qcolordialog.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QColor <b><a href="qcolordialog.html#currentColor">currentColor</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcolordialog.html#done">done</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qcolordialog.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcolordialog.html#open-2">open</a></b> (<i>self</i>, QObject, SLOT()SLOT())</li><li><div class="fn" /><b><a href="qcolordialog.html#open-3">open</a></b> (<i>self</i>, callable)</li><li><div class="fn" />ColorDialogOptions <b><a href="qcolordialog.html#options">options</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qcolordialog.html#selectedColor">selectedColor</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcolordialog.html#setCurrentColor">setCurrentColor</a></b> (<i>self</i>, QColor)</li><li><div class="fn" /><b><a href="qcolordialog.html#setOption">setOption</a></b> (<i>self</i>, ColorDialogOption, bool&#160;<i>on</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qcolordialog.html#setOptions">setOptions</a></b> (<i>self</i>, ColorDialogOptions)</li><li><div class="fn" /><b><a href="qcolordialog.html#setVisible">setVisible</a></b> (<i>self</i>, bool)</li><li><div class="fn" />bool <b><a href="qcolordialog.html#testOption">testOption</a></b> (<i>self</i>, ColorDialogOption)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />int <b><a href="qcolordialog.html#customColor">customColor</a></b> (int)</li><li><div class="fn" />int <b><a href="qcolordialog.html#customCount">customCount</a></b> ()</li><li><div class="fn" />QColor <b><a href="qcolordialog.html#getColor">getColor</a></b> (QColor&#160;<i>initial</i>&#160;=&#160;Qt.white, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />QColor <b><a href="qcolordialog.html#getColor-2">getColor</a></b> (QColor, QWidget, QString, ColorDialogOptions&#160;<i>options</i>&#160;=&#160;0)</li><li><div class="fn" />(int, bool&#160;<i>ok</i>) <b><a href="qcolordialog.html#getRgba">getRgba</a></b> (int&#160;<i>initial</i>&#160;=&#160;4294967295, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qcolordialog.html#setCustomColor">setCustomColor</a></b> (int, int)</li><li><div class="fn" /><b><a href="qcolordialog.html#setStandardColor">setStandardColor</a></b> (int, int)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qcolordialog.html#colorSelected">colorSelected</a></b> (const QColor&amp;)</li><li><div class="fn" />void <b><a href="qcolordialog.html#currentColorChanged">currentColorChanged</a></b> (const QColor&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QColorDialog class provides a dialog widget for specifying colors.</p>
<p>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.</p>
<p>The static functions provide modal color dialogs.</p>
<p>The static <a href="qcolordialog.html#getColor">getColor</a>() 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 <a href="qcolordialog.html#ColorDialogOption-enum">ShowAlphaChannel</a> option as an additional argument.</p>
<p>The user can store <a href="qcolordialog.html#customCount">customCount</a>() different custom colors. The custom colors are shared by all color dialogs, and remembered during the execution of the program. Use <a href="qcolordialog.html#setCustomColor">setCustomColor</a>() to set the custom colors, and use <a href="qcolordialog.html#customColor">customColor</a>() to get them.</p>
<p>Additional widgets that allow users to pick colors are available as <a href="http://qt.nokia.com/products/add-on-products">Qt Solutions</a>.</p>
<p>The <a href="dialogs-standarddialogs.html">Standard Dialogs</a> example shows how to use QColorDialog as well as other built-in Qt dialogs.</p>
<p align="center"><img alt="A color dialog in the Plastique widget style." src="images/plastique-colordialog.png" /></p><p>See also <a href="qcolor.html">QColor</a>, <a href="qfiledialog.html">QFileDialog</a>, <a href="qprintdialog.html">QPrintDialog</a>, <a href="qfontdialog.html">QFontDialog</a>, and <a href="dialogs-standarddialogs.html">Standard Dialogs Example</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ColorDialogOption-enum" />QColorDialog.ColorDialogOption</h3><p>This enum specifies various options that affect the look and feel of a color dialog.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QColorDialog.ShowAlphaChannel</tt></td><td align="center" valign="top"><tt>0x00000001</tt></td><td valign="top">Allow the user to select the alpha component of a color.</td></tr>
<tr><td valign="top"><tt>QColorDialog.NoButtons</tt></td><td align="center" valign="top"><tt>0x00000002</tt></td><td valign="top">Don't display <b>OK</b> and <b>Cancel</b> buttons. (Useful for "live dialogs".)</td></tr>
<tr><td valign="top"><tt>QColorDialog.DontUseNativeDialog</tt></td><td align="center" valign="top"><tt>0x00000004</tt></td><td valign="top">Use Qt's standard color dialog on the Mac instead of Apple's native color panel.</td></tr>
</table></p>
<p>This enum was introduced in Qt 4.5.</p>
<p>The ColorDialogOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;ColorDialogOption&gt;. It stores an OR combination of ColorDialogOption values.</p>
<p>See also <a href="qcolordialog.html#options-prop">options</a>, <a href="qcolordialog.html#setOption">setOption</a>(), <a href="qcolordialog.html#testOption">testOption</a>(), and <a href="qwidget.html#windowModality-prop">windowModality</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QColorDialog" />QColorDialog.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a color dialog with the given <i>parent</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="QColorDialog-2" />QColorDialog.__init__ (<i>self</i>, <a href="qcolor.html">QColor</a>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a color dialog with the given <i>parent</i> and specified <i>initial</i> color.</p>
<p>This function was introduced in Qt 4.5.</p>
<a name="//apple_ref/cpp/instm/QColorDialog/~QColorDialog" />
<h3 class="fn"><a name="changeEvent" />QColorDialog.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QColorDialog/colorSelected" />
<h3 class="fn"><a name="currentColor" /><a href="qcolor.html">QColor</a> QColorDialog.currentColor (<i>self</i>)</h3><h3 class="fn"><a name="customColor" />int QColorDialog.customColor (int)</h3><p>Returns the custom color at the given <i>index</i> as a <a href="qcolor.html#QRgb-typedef">QRgb</a> value.</p>
<p>This function was introduced in Qt 4.5.</p>
<p>See also <a href="qcolordialog.html#setCustomColor">setCustomColor</a>().</p>
<a name="//apple_ref/cpp/clm/QColorDialog/customCount" />
<h3 class="fn"><a name="customCount" />int QColorDialog.customCount ()</h3><p>Returns the number of custom colors supported by <a href="qcolordialog.html">QColorDialog</a>. All color dialogs share the same custom colors.</p>
<a name="//apple_ref/cpp/instm/QColorDialog/done" />
<h3 class="fn"><a name="done" />QColorDialog.done (<i>self</i>, int)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p>
<p>Closes the dialog and sets its result code to <i>result</i>. If this dialog is shown with <a href="qdialog.html#exec">exec_</a>(), done() causes the local event loop to finish, and <a href="qdialog.html#exec">exec_</a>() to return <i>result</i>.</p>
<p>See also <a href="qdialog.html#done">QDialog.done</a>().</p>
<a name="//apple_ref/cpp/clm/QColorDialog/getColor" />
<h3 class="fn"><a name="getColor" /><a href="qcolor.html">QColor</a> QColorDialog.getColor (<a href="qcolor.html">QColor</a>&#160;<i>initial</i>&#160;=&#160;Qt.white, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>Pops up a modal color dialog with the given window <i>title</i> (or "Select Color" if none is specified), lets the user choose a color, and returns that color. The color is initially set to <i>initial</i>. The dialog is a child of <i>parent</i>. It returns an invalid (see <a href="qcolor.html#isValid">QColor.isValid</a>()) color if the user cancels the dialog.</p>
<p>The <i>options</i> argument allows you to customize the dialog.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="getColor-2" /><a href="qcolor.html">QColor</a> QColorDialog.getColor (<a href="qcolor.html">QColor</a>, <a href="qwidget.html">QWidget</a>, QString, <a href="qcolordialog-colordialogoptions.html">ColorDialogOptions</a>&#160;<i>options</i>&#160;=&#160;0)</h3><p>Pops up a modal color dialog, lets the user choose a color, and returns that color. The color is initially set to <i>initial</i>. The dialog is a child of <i>parent</i>. It returns an invalid (see <a href="qcolor.html#isValid">QColor.isValid</a>()) color if the user cancels the dialog.</p>
<a name="//apple_ref/cpp/instm/QColorDialog/open" />
<h3 class="fn"><a name="getRgba" />(int, bool&#160;<i>ok</i>) QColorDialog.getRgba (int&#160;<i>initial</i>&#160;=&#160;4294967295, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><h3 class="fn"><a name="open" />QColorDialog.open (<i>self</i>)</h3><p>Shows the dialog as a <a href="qdialog.html#modal-dialogs">window modal dialog</a>, returning immediately.</p>
<p>This function was introduced in Qt 4.5.</p>
<p>See also <a href="qdialog.html#open">QDialog.open</a>().</p>
<h3 class="fn"><a name="open-2" />QColorDialog.open (<i>self</i>, <a href="qobject.html">QObject</a>, SLOT()SLOT())</h3><p>This is an overloaded function.</p>
<p>Opens the dialog and connects its <a href="qcolordialog.html#colorSelected">colorSelected</a>() signal to the slot specified by <i>receiver</i> and <i>member</i>.</p>
<p>The signal will be disconnected from the slot when the dialog is closed.</p>
<p>This function was introduced in Qt 4.5.</p>
<a name="//apple_ref/cpp/instm/QColorDialog/selectedColor" />
<h3 class="fn"><a name="open-3" />QColorDialog.open (<i>self</i>, callable)</h3><h3 class="fn"><a name="options" /><a href="qcolordialog-colordialogoptions.html">ColorDialogOptions</a> QColorDialog.options (<i>self</i>)</h3><h3 class="fn"><a name="selectedColor" /><a href="qcolor.html">QColor</a> QColorDialog.selectedColor (<i>self</i>)</h3><p>Returns the color that the user selected by clicking the <b>OK</b> or equivalent button.</p>
<p><b>Note:</b> This color is not always the same as the color held by the <a href="qcolordialog.html#currentColor-prop">currentColor</a> property since the user can choose different colors before finally selecting the one to use.</p>
<a name="//apple_ref/cpp/clm/QColorDialog/setCustomColor" />
<h3 class="fn"><a name="setCurrentColor" />QColorDialog.setCurrentColor (<i>self</i>, <a href="qcolor.html">QColor</a>)</h3><h3 class="fn"><a name="setCustomColor" />QColorDialog.setCustomColor (int, int)</h3><p>Sets the custom color at <i>index</i> to the <a href="qcolor.html#QRgb-typedef">QRgb</a> <i>color</i> value.</p>
<p><b>Note:</b> This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the <a href="qcolordialog.html#ColorDialogOption-enum">QColorDialog.DontUseNativeDialog</a> option.</p>
<p>See also <a href="qcolordialog.html#customColor">customColor</a>().</p>
<a name="//apple_ref/cpp/instm/QColorDialog/setOption" />
<h3 class="fn"><a name="setOption" />QColorDialog.setOption (<i>self</i>, <a href="qcolordialog.html#ColorDialogOption-enum">ColorDialogOption</a>, bool&#160;<i>on</i>&#160;=&#160;True)</h3><p>Sets the given <i>option</i> to be enabled if <i>on</i> is true; otherwise, clears the given <i>option</i>.</p>
<p>See also <a href="qcolordialog.html#options-prop">options</a> and <a href="qcolordialog.html#testOption">testOption</a>().</p>
<a name="//apple_ref/cpp/clm/QColorDialog/setStandardColor" />
<h3 class="fn"><a name="setOptions" />QColorDialog.setOptions (<i>self</i>, <a href="qcolordialog-colordialogoptions.html">ColorDialogOptions</a>)</h3><h3 class="fn"><a name="setStandardColor" />QColorDialog.setStandardColor (int, int)</h3><p>Sets the standard color at <i>index</i> to the <a href="qcolor.html#QRgb-typedef">QRgb</a> <i>color</i> value.</p>
<p><b>Note:</b> This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the <a href="qcolordialog.html#ColorDialogOption-enum">QColorDialog.DontUseNativeDialog</a> option.</p>
<a name="//apple_ref/cpp/instm/QColorDialog/setVisible" />
<h3 class="fn"><a name="setVisible" />QColorDialog.setVisible (<i>self</i>, bool)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>
<p>Changes the visibility of the dialog. If <i>visible</i> is true, the dialog is shown; otherwise, it is hidden.</p>
<a name="//apple_ref/cpp/instm/QColorDialog/testOption" />
<h3 class="fn"><a name="testOption" />bool QColorDialog.testOption (<i>self</i>, <a href="qcolordialog.html#ColorDialogOption-enum">ColorDialogOption</a>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise, returns false.</p>
<p>This function was introduced in Qt 4.5.</p>
<p>See also <a href="qcolordialog.html#options-prop">options</a> and <a href="qcolordialog.html#setOption">setOption</a>().</p>
<p /><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="colorSelected" />void colorSelected (const QColor&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just after the user has clicked <b>OK</b> to select a color to use. The chosen color is specified by <i>color</i>.</p>
<p>See also <a href="stylesheet-reference.html#color">color</a> and <a href="qcolordialog.html#currentColorChanged">currentColorChanged</a>().</p>
<a name="//apple_ref/cpp/instm/QColorDialog/currentColorChanged" />
<h3 class="fn"><a name="currentColorChanged" />void currentColorChanged (const QColor&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the current color changes in the dialog. The current color is specified by <i>color</i>.</p>
<p>See also <a href="stylesheet-reference.html#color">color</a> and <a href="qcolordialog.html#colorSelected">colorSelected</a>().</p>
<a name="//apple_ref/cpp/clm/QColorDialog/customColor" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>