JKQtExtras
a library of useful Qt widgets and tools
JKQTEColorSampler Class Reference

a widget which display a color (sample) More...

#include <jkqtecolorsampler.h>

Inheritance diagram for JKQTEColorSampler:
Collaboration diagram for JKQTEColorSampler:

Public Types

enum  SamplerMode {
  CircleSampler =0,
  RectangleSampler
}
 available modes for the slider More...
 

Public Slots

void setColor (QColor col)
 sets the color to display More...
 
void setSamplerMode (SamplerMode m)
 sets the display mode of the color sampler More...
 

Public Member Functions

 JKQTEColorSampler (QWidget *parent=nullptr)
 
QColor color () const
 sets the color to display More...
 
virtual QSize minimumSizeHint () const override
 
SamplerMode samplerMode () const
 sets the display mode of the color sampler More...
 
virtual QSize sizeHint () const override
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *ev) override
 paints the sampler More...
 

Protected Attributes

QColor m_color
 
SamplerMode m_samplerMode
 

Properties

QColor color
 
SamplerMode samplerMode
 

Detailed Description

a widget which display a color (sample)

Screenshots:

Basic usage is simple:

// set sampler mode
// set sampler color
sampler->setColor(QColor("red"));

Member Enumeration Documentation

◆ SamplerMode

available modes for the slider

the appearance and the range of the slider depend on this 
Enumerator
CircleSampler 

color is shown as a filled circle

RectangleSampler 

color is shown as a filled rectangle

Constructor & Destructor Documentation

◆ JKQTEColorSampler()

JKQTEColorSampler::JKQTEColorSampler ( QWidget *  parent = nullptr)
explicit

Member Function Documentation

◆ color()

QColor JKQTEColorSampler::color ( ) const

sets the color to display

◆ minimumSizeHint()

virtual QSize JKQTEColorSampler::minimumSizeHint ( ) const
overridevirtual

◆ paintEvent()

virtual void JKQTEColorSampler::paintEvent ( QPaintEvent *  ev)
overrideprotectedvirtual

paints the sampler

◆ samplerMode()

SamplerMode JKQTEColorSampler::samplerMode ( ) const

sets the display mode of the color sampler

◆ setColor

void JKQTEColorSampler::setColor ( QColor  col)
slot

sets the color to display

◆ setSamplerMode

void JKQTEColorSampler::setSamplerMode ( SamplerMode  m)
slot

sets the display mode of the color sampler

◆ sizeHint()

virtual QSize JKQTEColorSampler::sizeHint ( ) const
overridevirtual

Member Data Documentation

◆ m_color

QColor JKQTEColorSampler::m_color
protected

◆ m_samplerMode

SamplerMode JKQTEColorSampler::m_samplerMode
protected

Property Documentation

◆ color

QColor JKQTEColorSampler::color
readwrite

◆ samplerMode

SamplerMode JKQTEColorSampler::samplerMode
readwrite

The documentation for this class was generated from the following file:
JKQTEColorSampler::setSamplerMode
void setSamplerMode(SamplerMode m)
sets the display mode of the color sampler
JKQTEColorSampler::RectangleSampler
@ RectangleSampler
Definition: jkqtecolorsampler.h:29
JKQTEColorSampler::JKQTEColorSampler
JKQTEColorSampler(QWidget *parent=nullptr)
JKQTEColorSampler::setColor
void setColor(QColor col)
sets the color to display
JKQTEColorSampler
a widget which display a color (sample)
Definition: jkqtecolorsampler.h:19