|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QDialog
com.trolltech.qt.gui.QColorDialog
public class QColorDialog
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.
QColor
, QFileDialog
, QPrintDialog
, QFontDialog
, and Standard Dialogs Example.
Nested Class Summary | |
---|---|
static class |
QColorDialog.ColorDialogOption
This enum specifies various options that affect the look and feel of a color dialog. |
static class |
QColorDialog.ColorDialogOptions
|
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QDialog |
---|
QDialog.DialogCode |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary | |
---|---|
QSignalEmitter.Signal1 |
colorSelected
This signal takes 1 generic argument(s). |
QSignalEmitter.Signal1 |
currentColorChanged
This signal takes 1 generic argument(s). |
Fields inherited from class com.trolltech.qt.gui.QDialog |
---|
accepted, finished, rejected |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QColorDialog()
Constructs a color dialog with the given parent. |
|
QColorDialog(QColor initial)
Constructs a color dialog with the given parent and specified initial color. |
|
QColorDialog(QColor initial,
QWidget parent)
Constructs a color dialog with the given parent and specified initial color. |
|
QColorDialog(QWidget parent)
Constructs a color dialog with the given parent. |
Method Summary | |
---|---|
QColor |
currentColor()
This property holds the currently selected color in the dialog. |
static int |
customColor(int index)
Returns the custom color at the given index as a QRgb value. |
static int |
customCount()
Returns the number of custom colors supported by QColorDialog. |
static QColor |
getColor()
Pops up a modal color dialog, lets the user choose a color, and returns that color. |
static QColor |
getColor(QColor initial)
Pops up a modal color dialog, lets the user choose a color, and returns that color. |
static QColor |
getColor(QColor initial,
QWidget parent)
Pops up a modal color dialog, lets the user choose a color, and returns that color. |
static QColor |
getColor(QColor initial,
QWidget parent,
java.lang.String title)
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. |
static QColor |
getColor(QColor initial,
QWidget parent,
java.lang.String title,
QColorDialog.ColorDialogOption[] options)
This is an overloaded method provided for convenience. |
static QColor |
getColor(QColor initial,
QWidget parent,
java.lang.String title,
QColorDialog.ColorDialogOptions options)
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. |
static java.lang.Integer |
getRgba(int initial,
QWidget parent)
|
static java.lang.Integer |
getRgba(QWidget parent)
|
QColorDialog.ColorDialogOptions |
options()
This property holds the various options that affect the look and feel of the dialog. |
QColor |
selectedColor()
Returns the color that the user selected by clicking the OK or equivalent button. |
void |
setCurrentColor(QColor color)
This property holds the currently selected color in the dialog. |
static void |
setCustomColor(int index,
int color)
Sets the custom color at index to the QRgbcolor value. |
void |
setOption(QColorDialog.ColorDialogOption option)
Sets the given option to be enabled if on is true; otherwise, clears the given option. |
void |
setOption(QColorDialog.ColorDialogOption option,
boolean on)
Sets the given option to be enabled if on is true; otherwise, clears the given option. |
void |
setOptions(QColorDialog.ColorDialogOption[] options)
This is an overloaded method provided for convenience. |
void |
setOptions(QColorDialog.ColorDialogOptions options)
This property holds the various options that affect the look and feel of the dialog. |
static void |
setStandardColor(int index,
int color)
Sets the standard color at index to the QRgbcolor value. |
boolean |
testOption(QColorDialog.ColorDialogOption option)
Returns true if the given option is enabled; otherwise, returns false. |
Methods inherited from class com.trolltech.qt.gui.QDialog |
---|
accept, done, exec, isSizeGripEnabled, open, reject, result, setModal, setResult, setSizeGripEnabled |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1 colorSelected
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QColor(named: color)>:
This signal is emitted just after the user has clicked OK to select a color to use. The chosen color is specified by color.
currentColorChanged()
.
public final QSignalEmitter.Signal1 currentColorChanged
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QColor(named: color)>:
This signal is emitted whenever the current color changes in the dialog. The current color is specified by color.
colorSelected()
.
Constructor Detail |
---|
public QColorDialog()
public QColorDialog(QWidget parent)
public QColorDialog(QColor initial)
public QColorDialog(QColor initial, QWidget parent)
Method Detail |
---|
public final QColor currentColor()
public final QColorDialog.ColorDialogOptions options()
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).
setOption()
, and testOption()
.
public final QColor selectedColor()
Note: This color is not always the same as the color held by the currentColor
property since the user can choose different colors before finally selecting the one to use.
public final void setCurrentColor(QColor color)
public final void setOption(QColorDialog.ColorDialogOption option)
options
, and testOption()
.
public final void setOption(QColorDialog.ColorDialogOption option, boolean on)
options
, and testOption()
.
public final void setOptions(QColorDialog.ColorDialogOption[] options)
public final void setOptions(QColorDialog.ColorDialogOptions options)
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).
setOption()
, and testOption()
.
public final boolean testOption(QColorDialog.ColorDialogOption option)
options
, and setOption()
.
public static int customColor(int index)
setCustomColor()
.
public static int customCount()
public static QColor getColor(QColor initial)
QColor::isValid()
) color if the user cancels the dialog.
public static QColor getColor()
QColor::isValid()
) color if the user cancels the dialog.
public static QColor getColor(QColor initial, QWidget parent)
QColor::isValid()
) color if the user cancels the dialog.
public static QColor getColor(QColor initial, QWidget parent, java.lang.String title, QColorDialog.ColorDialogOption[] options)
public static QColor getColor(QColor initial, QWidget parent, java.lang.String title)
QColor::isValid()
) color if the user cancels the dialog. The options argument allows you to customize the dialog.
public static QColor getColor(QColor initial, QWidget parent, java.lang.String title, QColorDialog.ColorDialogOptions options)
QColor::isValid()
) color if the user cancels the dialog. The options argument allows you to customize the dialog.
public static void setCustomColor(int index, int color)
Note: This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the QColorDialog::DontUseNativeDialog
option.
customColor()
.
public static void setStandardColor(int index, int color)
Note: This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the QColorDialog::DontUseNativeDialog
option.
public static java.lang.Integer getRgba(int initial, QWidget parent)
public static java.lang.Integer getRgba(QWidget parent)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |