Commit b8624bd4 authored by Halla Rempt's avatar Halla Rempt
Browse files

set/unset the canvas on canvas change on the color popups

BUG:322660
parent b3a7dfc6
......@@ -174,10 +174,21 @@ void KisColorSelectorBase::setCanvas(KisCanvas2 *canvas)
connect(m_canvas->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
this, SLOT(canvasResourceChanged(int, const QVariant&)), Qt::UniqueConnection);
}
if (m_popup) {
m_popup->setCanvas(canvas);
}
update();
}
void KisColorSelectorBase::unsetCanvas()
{
if (m_popup) {
m_popup->unsetCanvas();
}
m_canvas = 0;
}
void KisColorSelectorBase::mousePressEvent(QMouseEvent* event)
{
if(!rect().contains(event->pos())) {
......
......@@ -40,7 +40,7 @@ public:
void setPopupBehaviour(bool onMouseOver, bool onMouseClick);
void setColorSpace(const KoColorSpace* colorSpace);
virtual void setCanvas(KisCanvas2* canvas);
virtual void unsetCanvas() { m_canvas = 0; }
virtual void unsetCanvas();
const KoColorSpace* colorSpace() const;
enum ColorRole {Foreground, Background};
......
......@@ -80,7 +80,7 @@ void KisColorSelectorContainer::unsetCanvas()
m_canvas = 0;
}
void KisColorSelectorContainer::setCanvas(KisCanvas2 *canvas)
void KisColorSelectorContainer::setCanvas(KisCanvas2* canvas)
{
if (m_canvas) {
m_canvas->disconnectCanvasObserver(this);
......
......@@ -46,10 +46,16 @@ KisMinimalShadeSelector::KisMinimalShadeSelector(QWidget *parent) :
setMouseTracking(true);
}
void KisMinimalShadeSelector::unsetCanvas()
{
KisColorSelectorBase::unsetCanvas();
m_canvas = 0;
}
void KisMinimalShadeSelector::setCanvas(KisCanvas2 *canvas)
{
KisColorSelectorBase::setCanvas(canvas);
m_canvas=canvas;
m_canvas = canvas;
}
void KisMinimalShadeSelector::setColor(const QColor& color)
......
......@@ -28,6 +28,7 @@ class KisMinimalShadeSelector : public KisColorSelectorBase
Q_OBJECT
public:
explicit KisMinimalShadeSelector(QWidget *parent = 0);
void unsetCanvas();
void setCanvas(KisCanvas2* canvas);
public slots:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment