Loading...
Searching...
No Matches
ColorButton Class Reference

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

`#include <avogadro/colorbutton.h>`

Inheritance diagram for ColorButton:

## Public Slots

void | changeColor ()

## Signals

void | colorChanged (const QColor &)

## Public Member Functions

| ColorButton (QWidget *parent=nullptr)
| ColorButton (const QColor &initial, QWidget *parent=nullptr)
void | paintEvent (QPaintEvent *) override
void | setColor (const QColor &color)
void | setDialogTitle (const QString title="")
QColor | color () const

## Protected Member Functions

bool | event (QEvent *e) override

## Protected Attributes

QColor | m_color
| The current color.
QString | m_title
| The current dialog title.

## Detailed Description

Author
  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 minimum size of 35x20 pixels.

## Member Function Documentation

## paintEvent()

void paintEvent | ( | QPaintEvent * |  | ) |

override

Redraw the widget (i.e., refresh the colored rectangle)

## setColor()

void setColor | ( | const QColor & | color | ) |

Parameters

  color | the new color to be used

## setDialogTitle()

void setDialogTitle | ( | const QString | title = "" | ) |

Parameters

  title | custom title for color choice dialog

## color()

QColor color | ( |  | ) | const

Returns
  the current color

## colorChanged

void colorChanged | ( | const QColor & |  | ) |

signal

emit any time the color is changed, either by a user or by setColor()

## changeColor

void changeColor | ( |  | ) |

slot

Call for a change in the current color

## event()

bool event | ( | QEvent * | e | ) |

override protected

Generic event handler, currently defaults to calling parent class (included for future compatibility)

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

- colorbutton.h