Avogadro
1.1.0
|
A button to show the current color and bring up the QColorDialog. More...
#include <avogadro/colorbutton.h>
Public Slots | |
void | changeColor () |
Signals | |
void | colorChanged (QColor) |
Public Member Functions | |
ColorButton (QWidget *parent=0) | |
ColorButton (const QColor &initial, QWidget *parent=0) | |
void | paintEvent (QPaintEvent *) |
void | setColor (const QColor &color) |
void | setDialogTitle (const QString title="") |
QColor | color () const |
Protected Member Functions | |
bool | event (QEvent *e) |
Protected Attributes | |
QColor | m_color |
The current color. | |
QString | m_title |
The current dialog title. |
A button to show the current color and bring up the QColorDialog.
The widget has a default minimium size of 35x20 pixels.
void Avogadro::ColorButton::changeColor | ( | ) | [slot] |
Call for a change in the current color
References colorChanged(), QColorDialog::getColor(), m_color, m_title, and QWidget::update().
QColor Avogadro::ColorButton::color | ( | ) | const |
void Avogadro::ColorButton::colorChanged | ( | QColor | ) | [signal] |
emit any time the color is changed, either by a user or by setColor()
Referenced by changeColor(), and setColor().
bool Avogadro::ColorButton::event | ( | QEvent * | e | ) | [protected, virtual] |
Generic event handler, currently defaults to calling parent class (included for future compatibility)
Reimplemented from QAbstractButton.
void Avogadro::ColorButton::paintEvent | ( | QPaintEvent * | ) | [virtual] |
Redraw the widget (i.e., refresh the colored rectange)
Reimplemented from QAbstractButton.
References QPainter::drawRect(), QWidget::height(), m_color, QPainter::setBrush(), and QWidget::width().
void Avogadro::ColorButton::setColor | ( | const QColor & | color | ) |
color | the new color to be used |
References color(), colorChanged(), m_color, and QWidget::update().
void Avogadro::ColorButton::setDialogTitle | ( | const QString | title = "" | ) |
custom | title for color choice dialog |
References m_title.