Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
color_widgets
include
swatch.hpp
Go to the documentation of this file.
1
22
#ifndef COLOR_WIDGETS_SWATCH_HPP
23
#define COLOR_WIDGETS_SWATCH_HPP
24
25
#include <QWidget>
26
#include <QPen>
27
#include "
color_palette.hpp
"
28
29
namespace
color_widgets
{
30
34
class
Swatch
:
public
QWidget
35
{
36
Q_OBJECT
37
41
Q_PROPERTY(
const
ColorPalette
&
palette
READ
palette
WRITE
setPalette
NOTIFY
paletteChanged
)
45
Q_PROPERTY(
int
selected
READ
selected
WRITE
setSelected
NOTIFY
selectedChanged
)
46
50
Q_PROPERTY(QSize
colorSize
READ
colorSize
WRITE
setColorSize
NOTIFY
colorSizeChanged
)
51
52
Q_PROPERTY(
ColorSizePolicy
colorSizePolicy
READ
colorSizePolicy
WRITE
setColorSizePolicy
NOTIFY
colorSizePolicyChanged
)
53
57
Q_PROPERTY(QPen
border
READ
border
WRITE
setBorder
NOTIFY
borderChanged
)
58
69
Q_PROPERTY(
int
forcedRows
READ
forcedRows
WRITE
setForcedRows
NOTIFY
forcedRowsChanged
)
70
81
Q_PROPERTY(
int
forcedColumns
READ
forcedColumns
WRITE
setForcedColumns
NOTIFY
forcedColumnsChanged
)
82
87
Q_PROPERTY(
bool
readOnly
READ
readOnly
WRITE
setReadOnly
NOTIFY
readOnlyChanged
)
88
89
90
public:
91
enum
ColorSizePolicy
92
{
93
Hint
,
94
Minimum
,
95
Fixed
96
};
97
Q_ENUMS(
ColorSizePolicy
)
98
99
Swatch
(QWidget* parent = 0);
100
~
Swatch
();
101
102
QSize
sizeHint
() const Q_DECL_OVERRIDE;
103
QSize
minimumSizeHint
() const Q_DECL_OVERRIDE;
104
105
const
ColorPalette
&
palette
() const;
106
ColorPalette
&
palette
();
107
int
selected
() const;
111
QColor
selectedColor
() const;
112
118
int
indexAt
(const QPoint&
p
);
119
124
QColor
colorAt
(const QPoint& p);
125
126
QSize
colorSize
() const;
127
ColorSizePolicy
colorSizePolicy
() const;
128
QPen
border
() const;
129
130
int
forcedRows
() const;
131
int
forcedColumns
() const;
132
133
bool
readOnly
() const;
134
135
public slots:
136
void
setPalette
(const
ColorPalette
& palette);
137
void
setSelected
(
int
selected
);
138
void
clearSelection
();
139
void
setColorSize
(const QSize&
colorSize
);
140
void
setColorSizePolicy
(
ColorSizePolicy
colorSizePolicy
);
141
void
setBorder
(const QPen&
border
);
142
void
setForcedRows
(
int
forcedRows
);
143
void
setForcedColumns
(
int
forcedColumns
);
144
void
setReadOnly
(
bool
readOnly
);
148
void
removeSelected
();
149
150
signals:
151
void
paletteChanged
(const
ColorPalette
& palette);
152
void
selectedChanged
(
int
selected);
153
void
colorSelected
(const QColor& color);
154
void
colorSizeChanged
(const QSize& colorSize);
155
void
colorSizePolicyChanged
(
ColorSizePolicy
colorSizePolicy);
156
void
doubleClicked
(
int
index);
157
void
rightClicked
(
int
index);
158
void
forcedRowsChanged
(
int
forcedRows);
159
void
forcedColumnsChanged
(
int
forcedColumns);
160
void
readOnlyChanged
(
bool
readOnly);
161
void
borderChanged
(const QPen& border);
162
163
protected:
164
bool
event
(QEvent*
event
) Q_DECL_OVERRIDE;
165
166
void
paintEvent
(QPaintEvent*
event
) Q_DECL_OVERRIDE;
167
168
void
keyPressEvent
(QKeyEvent*
event
) Q_DECL_OVERRIDE;
169
170
void
mousePressEvent
(QMouseEvent *
event
) Q_DECL_OVERRIDE;
171
void
mouseReleaseEvent
(QMouseEvent *
event
) Q_DECL_OVERRIDE;
172
void
mouseMoveEvent
(QMouseEvent *
event
) Q_DECL_OVERRIDE;
173
void
mouseDoubleClickEvent
(QMouseEvent *
event
) Q_DECL_OVERRIDE;
174
void
wheelEvent
(QWheelEvent*
event
) Q_DECL_OVERRIDE;
175
176
void
dragEnterEvent
(QDragEnterEvent *
event
) Q_DECL_OVERRIDE;
177
void
dragMoveEvent
(QDragMoveEvent*
event
) Q_DECL_OVERRIDE;
178
void
dragLeaveEvent
(QDragLeaveEvent *
event
) Q_DECL_OVERRIDE;
179
void
dropEvent
(QDropEvent*
event
) Q_DECL_OVERRIDE;
180
181
protected slots:
185
void
paletteModified
();
186
187
private:
188
class
Private
;
189
Private* p;
190
};
191
192
193
}
// namespace color_widgets
194
#endif // COLOR_WIDGETS_SWATCH_HPP
color_widgets::Swatch::forcedRowsChanged
void forcedRowsChanged(int forcedRows)
color_widgets::ColorPalette
Definition:
color_palette.hpp:34
color_widgets::Swatch::setPalette
void setPalette(const ColorPalette &palette)
Definition:
swatch.cpp:299
color_widgets::Swatch::Private
Definition:
swatch.cpp:38
color_widgets::Swatch::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:573
color_widgets::Swatch::setColorSize
void setColorSize(const QSize &colorSize)
Definition:
swatch.cpp:670
color_widgets::Swatch::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:544
color_widgets::Swatch
A widget drawing a palette.
Definition:
swatch.hpp:34
color_widgets::Swatch::colorSelected
void colorSelected(const QColor &color)
color_widgets::Swatch::wheelEvent
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:562
color_widgets::Swatch::readOnlyChanged
void readOnlyChanged(bool readOnly)
color_widgets::Swatch::colorSizeChanged
void colorSizeChanged(const QSize &colorSize)
color_widgets::Swatch::indexAt
int indexAt(const QPoint &p)
Color index at the given position within the widget.
Definition:
swatch.cpp:275
color_widgets::Swatch::selectedChanged
void selectedChanged(int selected)
color_widgets::Swatch::forcedColumnsChanged
void forcedColumnsChanged(int forcedColumns)
color_widgets::Swatch::forcedRows
int forcedRows() const
color_widgets::Swatch::event
bool event(QEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:740
color_widgets::Swatch::removeSelected
void removeSelected()
Remove the currently seleceted color.
Definition:
swatch.cpp:494
color_widgets::Swatch::setForcedColumns
void setForcedColumns(int forcedColumns)
Definition:
swatch.cpp:702
color_palette.hpp
color_widgets::Swatch::paletteModified
void paletteModified()
Connected to the internal palette object to keep eveything consistent.
Definition:
swatch.cpp:652
color_widgets::Swatch::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:520
color_widgets::Swatch::colorSizePolicyChanged
void colorSizePolicyChanged(ColorSizePolicy colorSizePolicy)
color_widgets::Swatch::selected
int selected() const
color_widgets::Swatch::colorAt
QColor colorAt(const QPoint &p)
Color at the given position within the widget.
Definition:
swatch.cpp:294
color_widgets::Swatch::dragLeaveEvent
void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:598
color_widgets::Swatch::paletteChanged
void paletteChanged(const ColorPalette &palette)
color_widgets::Swatch::colorSize
QSize colorSize() const
color_widgets::Swatch::rightClicked
void rightClicked(int index)
color_widgets::Swatch::border
QPen border() const
color_widgets::Swatch::sizeHint
QSize sizeHint() const Q_DECL_OVERRIDE
Definition:
swatch.cpp:235
color_widgets::Swatch::paintEvent
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:326
color_widgets::Swatch::setSelected
void setSelected(int selected)
Definition:
swatch.cpp:307
color_widgets::Swatch::setReadOnly
void setReadOnly(bool readOnly)
Definition:
swatch.cpp:731
color_widgets::Swatch::borderChanged
void borderChanged(const QPen &border)
color_widgets::Swatch::selectedColor
QColor selectedColor() const
Color at the currently selected index.
Definition:
swatch.cpp:270
color_widgets::Swatch::minimumSizeHint
QSize minimumSizeHint() const Q_DECL_OVERRIDE
Definition:
swatch.cpp:248
color_widgets::Swatch::dropEvent
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:603
color_widgets::Swatch::setColorSizePolicy
void setColorSizePolicy(ColorSizePolicy colorSizePolicy)
Definition:
swatch.cpp:681
color_widgets::Swatch::forcedColumns
int forcedColumns() const
color_widgets::Swatch::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:552
color_widgets::Swatch::setForcedRows
void setForcedRows(int forcedRows)
Definition:
swatch.cpp:714
color_widgets::Swatch::mousePressEvent
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:504
color_widgets::Swatch::readOnly
bool readOnly() const
color_widgets::Swatch::ColorSizePolicy
ColorSizePolicy
Definition:
swatch.hpp:91
color_widgets
Definition:
color_dialog.hpp:33
color_widgets::Swatch::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:591
color_widgets::Swatch::keyPressEvent
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE
Definition:
swatch.cpp:399
color_widgets::Swatch::Hint
The size is just a hint.
Definition:
swatch.hpp:93
color_widgets::Swatch::palette
const ColorPalette & palette() const
color_widgets::Swatch::setBorder
void setBorder(const QPen &border)
Definition:
swatch.cpp:774
color_widgets::Swatch::Fixed
Must be exactly as specified.
Definition:
swatch.hpp:95
color_widgets::Swatch::doubleClicked
void doubleClicked(int index)
color_widgets::Swatch::colorSizePolicy
ColorSizePolicy colorSizePolicy() const
color_widgets::Swatch::p
Private * p
Definition:
swatch.hpp:188
color_widgets::Swatch::clearSelection
void clearSelection()
Definition:
swatch.cpp:321
color_widgets::Swatch::Minimum
Can expand but not contract.
Definition:
swatch.hpp:94
plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18