![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <qtcolorpicker.h>


Public Slots | |
| void | setCurrentColor (const QColor &col) |
Signals | |
| void | colorChanged (const QColor &) |
Public Member Functions | |
| QtColorPicker (QWidget *parent=0, int columns=-1, bool enableColorDialog=true) | |
| ~QtColorPicker () | |
| void | insertColor (const QColor &color, const QString &text=QString(), int index=-1) |
| QColor | currentColor () const |
| QColor | color (int index) const |
| void | setColorDialogEnabled (bool enabled) |
| bool | colorDialogEnabled () const |
| void | setStandardColors () |
Static Public Member Functions | |
| static QColor | GetColor (const QPoint &pos, bool allowCustomColors=true) |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *e) |
Properties | |
| bool | colorDialog |
| Whether the ellipsis "..." (more) button is available. More... | |
Definition at line 22 of file qtcolorpicker.h.
| QtColorPicker::QtColorPicker | ( | QWidget * | parent = 0, |
| int | cols = -1, |
||
| bool | enableColorDialog = true |
||
| ) |
Constructs a QtColorPicker widget. The popup will display a grid with cols columns, or if cols is -1, the number of columns will be calculated automatically.
If enableColorDialog is true, the popup will also have a "More" button (signified by an ellipsis "...") that presents a QColorDialog when clicked.
After constructing a QtColorPicker, call insertColor() to add individual colors to the popup grid, or call setStandardColors() to add all the standard colors in one go.
The parent argument is passed to QFrame's constructor.
Definition at line 235 of file qtcolorpicker.cpp.
References ecvColor::black(), cloudViewer::core::Minimum(), and setCurrentColor().
| QtColorPicker::~QtColorPicker | ( | ) |
Destructs the QtColorPicker.
Definition at line 264 of file qtcolorpicker.cpp.
| QColor QtColorPicker::color | ( | int | index | ) | const |
Returns the color at position index.
Definition at line 343 of file qtcolorpicker.cpp.
References Widgets::ColorPickerPopup::color().
Referenced by insertColor(), paintEvent(), and setCurrentColor().
|
signal |
This signal is emitted when the QtColorPicker's color is changed. \a color is the new color. To obtain the color's name, use text().
Referenced by setCurrentColor().
| bool QtColorPicker::colorDialogEnabled | ( | ) | const |
Definition at line 429 of file qtcolorpicker.cpp.
| QColor QtColorPicker::currentColor | ( | ) | const |
Returns the currently selected color.
Definition at line 338 of file qtcolorpicker.cpp.
|
static |
Pops up a color grid with Qt default colors at \a point, using
global coordinates. If \a allowCustomColors is true, there will
also be a button on the popup that invokes QColorDialog.
For example:
\code
void Drawer::mouseReleaseEvent(QMouseEvent *e)
{
if (e->button() & RightButton) {
QColor color =
QtColorPicker::GetColor(mapToGlobal(e->pos())); } }
Definition at line 448 of file qtcolorpicker.cpp.
References ecvColor::black(), ecvColor::blue(), ecvColor::cyan(), ecvColor::darkBlue(), Widgets::ColorPickerPopup::exec(), ecvColor::green(), Widgets::ColorPickerPopup::insertColor(), Widgets::ColorPickerPopup::lastSelected(), ecvColor::magenta(), ecvColor::red(), ecvColor::white(), and ecvColor::yellow().
| void QtColorPicker::insertColor | ( | const QColor & | color, |
| const QString & | text = QString(), |
||
| int | index = -1 |
||
| ) |
Adds the color color with the name text to the color grid, at position index. If index is -1, the color is assigned automatically assigned a position, starting from left to right, top to bottom.
Definition at line 407 of file qtcolorpicker.cpp.
References color(), and Widgets::ColorPickerPopup::insertColor().
Referenced by Widgets::ColorPushButton::ColorPushButton(), setCurrentColor(), and setStandardColors().
|
protected |
Definition at line 304 of file qtcolorpicker.cpp.
| void QtColorPicker::setColorDialogEnabled | ( | bool | enabled | ) |
Definition at line 426 of file qtcolorpicker.cpp.
|
slot |
Makes color current. If color is not already in the color grid, it is inserted with the text "Custom".
This function emits the colorChanged() signal if the new color is valid, and different from the old one.
Definition at line 380 of file qtcolorpicker.cpp.
References color(), colorChanged(), Widgets::ColorPickerPopup::find(), insertColor(), Widgets::ColorPickerItem::setSelected(), and Widgets::ColorPickerItem::text().
Referenced by QtColorPicker().
| void QtColorPicker::setStandardColors | ( | ) |
Adds the 17 predefined colors from the Qt namespace.
(The names given to the colors, "Black", "White", "Red", etc., are all translatable.)
Definition at line 353 of file qtcolorpicker.cpp.
References ecvColor::black(), ecvColor::blue(), ecvColor::cyan(), ecvColor::darkBlue(), ecvColor::green(), insertColor(), ecvColor::magenta(), ecvColor::red(), ecvColor::white(), and ecvColor::yellow().
|
read |
Whether the ellipsis "..." (more) button is available.
If this property is set to TRUE, the color grid popup will include a "More" button (signified by an ellipsis, "...") which pops up a QColorDialog when clicked. The user will then be able to select any custom color they like.
Definition at line 1 of file qtcolorpicker.h.