OpenMS
ColorSelector Class Reference

A widget for selecting a color. More...

#include <OpenMS/VISUAL/ColorSelector.h>

Inheritance diagram for ColorSelector:
[legend]
Collaboration diagram for ColorSelector:
[legend]

Public Member Functions

 ColorSelector (QWidget *parent=nullptr)
 Constructor. More...
 
 ~ColorSelector () override
 Destructor. More...
 
const QColor & getColor ()
 Returns the selected color. More...
 
void setColor (const QColor &)
 Sets the selected color. More...
 
QSize sizeHint () const override
 Qt size hint. More...
 

Reimplemented Qt events

QColor color_
 
void paintEvent (QPaintEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 

Detailed Description

A widget for selecting a color.

It represents a color (displayed as background color) and allows changing the color.

The above example image shows four ColorSelector instances on the right side.

Constructor & Destructor Documentation

◆ ColorSelector()

ColorSelector ( QWidget parent = nullptr)

Constructor.

◆ ~ColorSelector()

~ColorSelector ( )
override

Destructor.

Member Function Documentation

◆ getColor()

const QColor& getColor ( )

Returns the selected color.

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  e)
overrideprotected

◆ paintEvent()

void paintEvent ( QPaintEvent *  e)
overrideprotected

◆ setColor()

void setColor ( const QColor &  )

Sets the selected color.

◆ sizeHint()

QSize sizeHint ( ) const
override

Qt size hint.

Member Data Documentation

◆ color_

QColor color_
protected