![]() |
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... | |
| 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.
References ecvColor::black(), cloudViewer::core::Minimum(), and setCurrentColor().
| QtColorPicker::~QtColorPicker | ( | ) |
Destructs the QtColorPicker.
| QColor QtColorPicker::color | ( | int | index | ) | const |
Returns the color at position index.
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 |
| QColor QtColorPicker::currentColor | ( | ) | const |
Returns the currently selected color.
|
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())); } }
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.
References color(), and Widgets::ColorPickerPopup::insertColor().
Referenced by Widgets::ColorPushButton::ColorPushButton(), setCurrentColor(), and setStandardColors().
| void QtColorPicker::setColorDialogEnabled | ( | bool | enabled | ) |
|
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.
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.)
References ecvColor::black(), ecvColor::blue(), ecvColor::cyan(), ecvColor::darkBlue(), ecvColor::green(), insertColor(), ecvColor::magenta(), ecvColor::red(), ecvColor::white(), and ecvColor::yellow().
|
readwrite |
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.