10#include <QApplication>
19#include <kconfiggroup.h>
20#include <ksharedconfig.h>
29 , m_configPrefix(configPrefix)
39 if (event->isAccepted() || !
rect().contains(event->pos()))
50 if (event->button() == Qt::LeftButton) {
51 m_canvas->resourceManager()->setForegroundColor(color);
52 }
else if (event->button() == Qt::RightButton) {
53 m_canvas->resourceManager()->setBackgroundColor(color);
68 if (event->isAccepted())
97 for (
int i = 0; i < buttonList.size(); i++) {
98 buttonList.at(i)->setParent(
this);
107 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"advancedColorSelector");
110 QBoxLayout::Direction layoutDirection;
113 layoutDirection = QBoxLayout::TopToBottom;
116 layoutDirection = QBoxLayout::LeftToRight;
119 QBoxLayout *boxLayout =
dynamic_cast<QBoxLayout*
>(layout());
121 boxLayout =
new QBoxLayout(layoutDirection,
this);
122 boxLayout->setContentsMargins(0, 0, 0, 0);
123 setLayout(boxLayout);
125 }
else if (boxLayout->direction() != layoutDirection) {
126 boxLayout->setDirection(layoutDirection);
void reloadWidgetConfig()
void setColors(const QList< KoColor > &colors)
boost::optional< KoColor > colorPatchAt(const QPoint &pos) const
QList< KoColor > colors() const
void addColorPatch(const KoColor &color)
void updateSettings() override
void mousePressEvent(QMouseEvent *) override
void setCanvas(KisCanvas2 *canvas) override
void mouseReleaseEvent(QMouseEvent *) override
KisColorPatchesTableView * m_colorPatchesView
QList< KoColor > colors() const
void setAdditionalButtons(QList< QWidget * > buttonList)
QList< QWidget * > m_buttonList
KisColorPatches(QString configPrefix, QWidget *parent=0)
void addColorPatch(const KoColor &color)
void unsetCanvas() override
void setColors(const QList< KoColor > &colors)
Base class for all color selectors, that should support color management and zooming.
void updateColorPreview(const KoColor &color)
virtual void updateSettings()
virtual void setCanvas(KisCanvas2 *canvas)
void mouseReleaseEvent(QMouseEvent *) override
void mousePressEvent(QMouseEvent *) override
virtual void unsetCanvas()
QPointer< KisCanvas2 > m_canvas
void setPopupBehaviour(bool onMouseOver, bool onMouseClick)