casa
$Rev:20696$
|
A widget that lets the user select a color: either one from a list, or a custom color. More...
#include <RSUtils.qo.h>
Public Member Functions | |
QtColorWidget (bool showButton=false, String setText="", QWidget *parent=NULL) | |
Constructor that uses default colors. | |
QtColorWidget (const vector< String > &colors, bool showButton=false, String setText="", QWidget *parent=NULL) | |
Constructor that uses the given colors. | |
~QtColorWidget () | |
Destructor. | |
String | getColor () const |
Returns the color that the user has chosen. | |
void | setColor (const String &color) |
Sets the displayed color to the given. | |
Static Public Member Functions | |
static vector< String > | defaultColors () |
Returns default colors. | |
Private Slots | |
void | colorChanged (int index) |
For when the user picks a different color in the chooser. | |
void | colorPick () |
For when the user clicks the "pick" button. | |
Private Member Functions | |
void | init (const vector< String > &colors, const String &setText, bool showButton) |
Initializes GUI members. | |
Private Attributes | |
QComboBox * | m_chooser |
Color chooser. | |
QLineEdit * | m_edit |
Custom color. | |
QPushButton * | m_button |
Picker button. |
A widget that lets the user select a color: either one from a list, or a custom color.
Definition at line 249 of file RSUtils.qo.h.
casa::QtColorWidget::QtColorWidget | ( | bool | showButton = false , |
String | setText = "" , |
||
QWidget * | parent = NULL |
||
) |
Constructor that uses default colors.
If setText is nonempty, the chooser is set to the given. If showButton is true, a "pick" button is shown for picking colors.
casa::QtColorWidget::QtColorWidget | ( | const vector< String > & | colors, |
bool | showButton = false , |
||
String | setText = "" , |
||
QWidget * | parent = NULL |
||
) |
Constructor that uses the given colors.
If setText is nonempty, the chooser is set to the given. If showButton is true, a "pick" button is shown for picking colors.
Destructor.
void casa::QtColorWidget::colorChanged | ( | int | index | ) | [private, slot] |
For when the user picks a different color in the chooser.
void casa::QtColorWidget::colorPick | ( | ) | [private, slot] |
For when the user clicks the "pick" button.
static vector<String> casa::QtColorWidget::defaultColors | ( | ) | [inline, static] |
Returns default colors.
Definition at line 279 of file RSUtils.qo.h.
String casa::QtColorWidget::getColor | ( | ) | const |
Returns the color that the user has chosen.
This will either be from the initial list, or in "#000000" form (see QColor::name()).
void casa::QtColorWidget::init | ( | const vector< String > & | colors, |
const String & | setText, | ||
bool | showButton | ||
) | [private] |
Initializes GUI members.
void casa::QtColorWidget::setColor | ( | const String & | color | ) |
Sets the displayed color to the given.
If the color is in the colors list, that index will be selected -- otherwise it will be entered in the custom color box.
QPushButton* casa::QtColorWidget::m_button [private] |
Picker button.
Definition at line 297 of file RSUtils.qo.h.
QComboBox* casa::QtColorWidget::m_chooser [private] |
Color chooser.
Definition at line 291 of file RSUtils.qo.h.
QLineEdit* casa::QtColorWidget::m_edit [private] |
Custom color.
Definition at line 294 of file RSUtils.qo.h.