Avogadro  1.1.0
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes
Avogadro::ColorButton Class Reference

A button to show the current color and bring up the QColorDialog. More...

#include <avogadro/colorbutton.h>

Inheritance diagram for Avogadro::ColorButton:
Inheritance graph

List of all members.

Public Slots

void changeColor ()


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.

Detailed Description

A button to show the current color and bring up the QColorDialog.

Geoffrey Hutchison This class implements a QAbstractButton to display a colored rectangle. When clicked by the user, it brings up a color picker to select a new color.

The widget has a default minimium size of 35x20 pixels.

Member Function Documentation

Call for a change in the current color

References colorChanged(), QColorDialog::getColor(), m_color, m_title, and QWidget::update().

the current color

References m_color.

Referenced by setColor().

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.

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)
colorthe new color to be used

References color(), colorChanged(), m_color, and QWidget::update().

void Avogadro::ColorButton::setDialogTitle ( const QString  title = "")
customtitle for color choice dialog

References m_title.

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