Classes | Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Properties | Private Attributes | List of all members
color_widgets::Swatch Class Reference

A widget drawing a palette. More...

#include <swatch.hpp>

Inheritance diagram for color_widgets::Swatch:
Inheritance graph
[legend]

Classes

class  Private
 

Public Types

enum  ColorSizePolicy { Hint, Minimum, Fixed }
 

Public Slots

void clearSelection ()
 
void removeSelected ()
 Remove the currently seleceted color. More...
 
void setBorder (const QPen &border)
 
void setColorSize (const QSize &colorSize)
 
void setColorSizePolicy (ColorSizePolicy colorSizePolicy)
 
void setForcedColumns (int forcedColumns)
 
void setForcedRows (int forcedRows)
 
void setPalette (const ColorPalette &palette)
 
void setReadOnly (bool readOnly)
 
void setSelected (int selected)
 

Signals

void borderChanged (const QPen &border)
 
void colorSelected (const QColor &color)
 
void colorSizeChanged (const QSize &colorSize)
 
void colorSizePolicyChanged (ColorSizePolicy colorSizePolicy)
 
void doubleClicked (int index)
 
void forcedColumnsChanged (int forcedColumns)
 
void forcedRowsChanged (int forcedRows)
 
void paletteChanged (const ColorPalette &palette)
 
void readOnlyChanged (bool readOnly)
 
void rightClicked (int index)
 
void selectedChanged (int selected)
 

Public Member Functions

QPen border () const
 
QColor colorAt (const QPoint &p)
 Color at the given position within the widget. More...
 
QSize colorSize () const
 
ColorSizePolicy colorSizePolicy () const
 
int forcedColumns () const
 
int forcedRows () const
 
int indexAt (const QPoint &p)
 Color index at the given position within the widget. More...
 
QSize minimumSizeHint () const Q_DECL_OVERRIDE
 
ColorPalettepalette ()
 
const ColorPalettepalette () const
 
bool readOnly () const
 
int selected () const
 
QColor selectedColor () const
 Color at the currently selected index. More...
 
QSize sizeHint () const Q_DECL_OVERRIDE
 
 Swatch (QWidget *parent=0)
 
 ~Swatch ()
 

Protected Slots

void paletteModified ()
 Connected to the internal palette object to keep eveything consistent. More...
 

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *event) Q_DECL_OVERRIDE
 
void dragLeaveEvent (QDragLeaveEvent *event) Q_DECL_OVERRIDE
 
void dragMoveEvent (QDragMoveEvent *event) Q_DECL_OVERRIDE
 
void dropEvent (QDropEvent *event) Q_DECL_OVERRIDE
 
bool event (QEvent *event) Q_DECL_OVERRIDE
 
void keyPressEvent (QKeyEvent *event) Q_DECL_OVERRIDE
 
void mouseDoubleClickEvent (QMouseEvent *event) Q_DECL_OVERRIDE
 
void mouseMoveEvent (QMouseEvent *event) Q_DECL_OVERRIDE
 
void mousePressEvent (QMouseEvent *event) Q_DECL_OVERRIDE
 
void mouseReleaseEvent (QMouseEvent *event) Q_DECL_OVERRIDE
 
void paintEvent (QPaintEvent *event) Q_DECL_OVERRIDE
 
void wheelEvent (QWheelEvent *event) Q_DECL_OVERRIDE
 

Properties

QPen border
 Border around the colors. More...
 
QSize colorSize
 Preferred size for a color square. More...
 
ColorSizePolicy colorSizePolicy
 
int forcedColumns
 Forces the Swatch to display that many columns of colors. More...
 
int forcedRows
 Forces the Swatch to display that many rows of colors. More...
 
const ColorPalette palette
 Palette shown by the widget. More...
 
bool readOnly
 Whether the palette can be modified via user interaction. More...
 
int selected
 Currently selected color (-1 if no color is selected) More...
 

Private Attributes

Privatep
 

Detailed Description

A widget drawing a palette.

Definition at line 34 of file swatch.hpp.

Member Enumeration Documentation

◆ ColorSizePolicy

Enumerator
Hint 

The size is just a hint.

Minimum 

Can expand but not contract.

Fixed 

Must be exactly as specified.

Definition at line 91 of file swatch.hpp.

Constructor & Destructor Documentation

◆ Swatch()

color_widgets::Swatch::Swatch ( QWidget *  parent = 0)

Definition at line 210 of file swatch.cpp.

◆ ~Swatch()

color_widgets::Swatch::~Swatch ( )

Definition at line 230 of file swatch.cpp.

Member Function Documentation

◆ border()

QPen color_widgets::Swatch::border ( ) const

◆ borderChanged

void color_widgets::Swatch::borderChanged ( const QPen &  border)
signal

◆ clearSelection

void color_widgets::Swatch::clearSelection ( )
slot

Definition at line 321 of file swatch.cpp.

◆ colorAt()

QColor color_widgets::Swatch::colorAt ( const QPoint &  p)

Color at the given position within the widget.

Parameters
pPoint in local coordinates

Definition at line 294 of file swatch.cpp.

◆ colorSelected

void color_widgets::Swatch::colorSelected ( const QColor &  color)
signal

◆ colorSize()

QSize color_widgets::Swatch::colorSize ( ) const

◆ colorSizeChanged

void color_widgets::Swatch::colorSizeChanged ( const QSize &  colorSize)
signal

◆ colorSizePolicy()

ColorSizePolicy color_widgets::Swatch::colorSizePolicy ( ) const

◆ colorSizePolicyChanged

void color_widgets::Swatch::colorSizePolicyChanged ( ColorSizePolicy  colorSizePolicy)
signal

◆ doubleClicked

void color_widgets::Swatch::doubleClicked ( int  index)
signal

◆ dragEnterEvent()

void color_widgets::Swatch::dragEnterEvent ( QDragEnterEvent *  event)
protected

Definition at line 573 of file swatch.cpp.

◆ dragLeaveEvent()

void color_widgets::Swatch::dragLeaveEvent ( QDragLeaveEvent *  event)
protected

Definition at line 598 of file swatch.cpp.

◆ dragMoveEvent()

void color_widgets::Swatch::dragMoveEvent ( QDragMoveEvent *  event)
protected

Definition at line 591 of file swatch.cpp.

◆ dropEvent()

void color_widgets::Swatch::dropEvent ( QDropEvent *  event)
protected

Definition at line 603 of file swatch.cpp.

◆ event()

bool color_widgets::Swatch::event ( QEvent *  event)
protected

Definition at line 740 of file swatch.cpp.

◆ forcedColumns()

int color_widgets::Swatch::forcedColumns ( ) const

◆ forcedColumnsChanged

void color_widgets::Swatch::forcedColumnsChanged ( int  forcedColumns)
signal

◆ forcedRows()

int color_widgets::Swatch::forcedRows ( ) const

◆ forcedRowsChanged

void color_widgets::Swatch::forcedRowsChanged ( int  forcedRows)
signal

◆ indexAt()

int color_widgets::Swatch::indexAt ( const QPoint &  p)

Color index at the given position within the widget.

Parameters
pPoint in local coordinates
Returns
-1 if the position doesn't represent any color

Definition at line 275 of file swatch.cpp.

◆ keyPressEvent()

void color_widgets::Swatch::keyPressEvent ( QKeyEvent *  event)
protected

Definition at line 399 of file swatch.cpp.

◆ minimumSizeHint()

QSize color_widgets::Swatch::minimumSizeHint ( ) const

Definition at line 248 of file swatch.cpp.

◆ mouseDoubleClickEvent()

void color_widgets::Swatch::mouseDoubleClickEvent ( QMouseEvent *  event)
protected

Definition at line 552 of file swatch.cpp.

◆ mouseMoveEvent()

void color_widgets::Swatch::mouseMoveEvent ( QMouseEvent *  event)
protected

Definition at line 520 of file swatch.cpp.

◆ mousePressEvent()

void color_widgets::Swatch::mousePressEvent ( QMouseEvent *  event)
protected

Definition at line 504 of file swatch.cpp.

◆ mouseReleaseEvent()

void color_widgets::Swatch::mouseReleaseEvent ( QMouseEvent *  event)
protected

Definition at line 544 of file swatch.cpp.

◆ paintEvent()

void color_widgets::Swatch::paintEvent ( QPaintEvent *  event)
protected

Definition at line 326 of file swatch.cpp.

◆ palette() [1/2]

ColorPalette& color_widgets::Swatch::palette ( )

◆ palette() [2/2]

const ColorPalette& color_widgets::Swatch::palette ( ) const

◆ paletteChanged

void color_widgets::Swatch::paletteChanged ( const ColorPalette palette)
signal

◆ paletteModified

void color_widgets::Swatch::paletteModified ( )
protectedslot

Connected to the internal palette object to keep eveything consistent.

Definition at line 652 of file swatch.cpp.

◆ readOnly()

bool color_widgets::Swatch::readOnly ( ) const

◆ readOnlyChanged

void color_widgets::Swatch::readOnlyChanged ( bool  readOnly)
signal

◆ removeSelected

void color_widgets::Swatch::removeSelected ( )
slot

Remove the currently seleceted color.

Definition at line 494 of file swatch.cpp.

◆ rightClicked

void color_widgets::Swatch::rightClicked ( int  index)
signal

◆ selected()

int color_widgets::Swatch::selected ( ) const

◆ selectedChanged

void color_widgets::Swatch::selectedChanged ( int  selected)
signal

◆ selectedColor()

QColor color_widgets::Swatch::selectedColor ( ) const

Color at the currently selected index.

Definition at line 270 of file swatch.cpp.

◆ setBorder

void color_widgets::Swatch::setBorder ( const QPen &  border)
slot

Definition at line 774 of file swatch.cpp.

◆ setColorSize

void color_widgets::Swatch::setColorSize ( const QSize &  colorSize)
slot

Definition at line 670 of file swatch.cpp.

◆ setColorSizePolicy

void color_widgets::Swatch::setColorSizePolicy ( ColorSizePolicy  colorSizePolicy)
slot

Definition at line 681 of file swatch.cpp.

◆ setForcedColumns

void color_widgets::Swatch::setForcedColumns ( int  forcedColumns)
slot

Definition at line 702 of file swatch.cpp.

◆ setForcedRows

void color_widgets::Swatch::setForcedRows ( int  forcedRows)
slot

Definition at line 714 of file swatch.cpp.

◆ setPalette

void color_widgets::Swatch::setPalette ( const ColorPalette palette)
slot

Definition at line 299 of file swatch.cpp.

◆ setReadOnly

void color_widgets::Swatch::setReadOnly ( bool  readOnly)
slot

Definition at line 731 of file swatch.cpp.

◆ setSelected

void color_widgets::Swatch::setSelected ( int  selected)
slot

Definition at line 307 of file swatch.cpp.

◆ sizeHint()

QSize color_widgets::Swatch::sizeHint ( ) const

Definition at line 235 of file swatch.cpp.

◆ wheelEvent()

void color_widgets::Swatch::wheelEvent ( QWheelEvent *  event)
protected

Definition at line 562 of file swatch.cpp.

Member Data Documentation

◆ p

Private* color_widgets::Swatch::p
private

Definition at line 188 of file swatch.hpp.

Property Documentation

◆ border

QPen color_widgets::Swatch::border
readwrite

Border around the colors.

Definition at line 57 of file swatch.hpp.

◆ colorSize

QSize color_widgets::Swatch::colorSize
readwrite

Preferred size for a color square.

Definition at line 50 of file swatch.hpp.

◆ colorSizePolicy

Swatch::ColorSizePolicy color_widgets::Swatch::colorSizePolicy
readwrite

Definition at line 52 of file swatch.hpp.

◆ forcedColumns

int color_widgets::Swatch::forcedColumns
readwrite

Forces the Swatch to display that many columns of colors.

If there are too few elements, the widget will display less than this many columns.

A value of 0 means that the number of columns is automatic.

Note
Conflicts with forcedRows

Definition at line 81 of file swatch.hpp.

◆ forcedRows

int color_widgets::Swatch::forcedRows
readwrite

Forces the Swatch to display that many rows of colors.

If there are too few elements, the widget will display less than this many rows.

A value of0 means that the number of rows is automatic.

Note
Conflicts with forcedColumns

Definition at line 69 of file swatch.hpp.

◆ palette

ColorPalette & color_widgets::Swatch::palette
readwrite

Palette shown by the widget.

Definition at line 41 of file swatch.hpp.

◆ readOnly

bool color_widgets::Swatch::readOnly
readwrite

Whether the palette can be modified via user interaction.

Note
Even when this is false, it can still be altered programmatically

Definition at line 87 of file swatch.hpp.

◆ selected

int color_widgets::Swatch::selected
readwrite

Currently selected color (-1 if no color is selected)

Definition at line 45 of file swatch.hpp.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:51