casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
casa::QtColorWidget Class Reference

A widget that lets the user select a color: either one from a list, or a custom color. More...

#include <RSUtils.qo.h>

Inheritance diagram for casa::QtColorWidget:

Public Member Functions

 QtColorWidget (bool showButton=false, casacore::String setText="", QWidget *parent=NULL)
 Constructor that uses default colors. More...
 
 QtColorWidget (const std::vector< casacore::String > &colors, bool showButton=false, casacore::String setText="", QWidget *parent=NULL)
 Constructor that uses the given colors. More...
 
 ~QtColorWidget ()
 Destructor. More...
 
casacore::String getColor () const
 Returns the color that the user has chosen. More...
 
void setColor (const casacore::String &color)
 Sets the displayed color to the given. More...
 

Static Public Member Functions

static std::vector
< casacore::String
defaultColors ()
 Returns default colors. More...
 

Private Slots

void colorChanged (int index)
 For when the user picks a different color in the chooser. More...
 
void colorPick ()
 For when the user clicks the "pick" button. More...
 

Private Member Functions

void init (const std::vector< casacore::String > &colors, const casacore::String &setText, bool showButton)
 Initializes GUI members. More...
 

Private Attributes

QComboBox * m_chooser
 Color chooser. More...
 
QLineEdit * m_edit
 Custom color. More...
 
QPushButton * m_button
 Picker button. More...
 

Detailed Description

A widget that lets the user select a color: either one from a list, or a custom color.

Definition at line 253 of file RSUtils.qo.h.

Constructor & Destructor Documentation

casa::QtColorWidget::QtColorWidget ( bool  showButton = false,
casacore::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 std::vector< casacore::String > &  colors,
bool  showButton = false,
casacore::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.

casa::QtColorWidget::~QtColorWidget ( )

Destructor.

Member Function Documentation

void casa::QtColorWidget::colorChanged ( int  index)
privateslot

For when the user picks a different color in the chooser.

void casa::QtColorWidget::colorPick ( )
privateslot

For when the user clicks the "pick" button.

static std::vector<casacore::String> casa::QtColorWidget::defaultColors ( )
inlinestatic

Returns default colors.

Definition at line 283 of file RSUtils.qo.h.

casacore::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 std::vector< casacore::String > &  colors,
const casacore::String setText,
bool  showButton 
)
private

Initializes GUI members.

void casa::QtColorWidget::setColor ( const casacore::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.

Member Data Documentation

QPushButton* casa::QtColorWidget::m_button
private

Picker button.

Definition at line 305 of file RSUtils.qo.h.

QComboBox* casa::QtColorWidget::m_chooser
private

Color chooser.

Definition at line 299 of file RSUtils.qo.h.

QLineEdit* casa::QtColorWidget::m_edit
private

Custom color.

Definition at line 302 of file RSUtils.qo.h.


The documentation for this class was generated from the following file: