Commit 6c23bcfa authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix regeneration of the Adv. Color selector when turning on/off the OCIO

parent 5f363353
......@@ -150,6 +150,19 @@ void KisColorSelector::updateSettings()
setConfiguration(Configuration::fromString(cfg.readEntry("colorSelectorConfiguration", KisColorSelector::Configuration().toString())));
}
void KisColorSelector::reset()
{
KisColorSelectorBase::reset();
if (m_mainComponent) {
m_mainComponent->setDirty();
}
if (m_subComponent) {
m_subComponent->setDirty();
}
}
void KisColorSelector::paintEvent(QPaintEvent* e)
{
Q_UNUSED(e);
......
......@@ -97,6 +97,7 @@ public:
void setColor(const KoColor &color);
public slots:
void reset();
void updateSettings();
signals:
......
......@@ -143,7 +143,7 @@ void KisColorSelectorBase::setCanvas(KisCanvas2 *canvas)
SLOT(canvasResourceChanged(int, const QVariant&)), Qt::UniqueConnection);
connect(m_canvas->displayColorConverter(), SIGNAL(displayConfigurationChanged()),
SLOT(update()));
SLOT(reset()));
setColor(Acs::currentColor(m_canvas->view()->resourceProvider(), Acs::Foreground));
}
......@@ -151,7 +151,7 @@ void KisColorSelectorBase::setCanvas(KisCanvas2 *canvas)
m_popup->setCanvas(canvas);
}
update();
reset();
}
void KisColorSelectorBase::unsetCanvas()
......@@ -436,6 +436,11 @@ void KisColorSelectorBase::updateSettings()
resize(cfg.readEntry("zoomSize", 280), cfg.readEntry("zoomSize", 280));
}
reset();
}
void KisColorSelectorBase::reset()
{
update();
}
......
......@@ -58,6 +58,11 @@ public:
virtual void setColor(const KoColor& color);
public slots:
/**
* Flushes caches and redraws the selectors
*/
virtual void reset();
virtual void updateSettings();
virtual void showPopup(Move move=MoveToMousePosition);
......
......@@ -81,6 +81,11 @@ const KoColorSpace* KisColorSelectorComponent::colorSpace() const
return cs;
}
void KisColorSelectorComponent::setDirty()
{
m_dirty = true;
}
bool KisColorSelectorComponent::isDirty() const
{
return m_dirty || m_lastColorSpace!=colorSpace();
......
......@@ -55,6 +55,9 @@ public:
/// set the color, blibs etc
virtual void setColor(const KoColor& color) = 0;
/// force subsequent redraw of the component
void setDirty();
/// returns true, if this component wants to grab the mouse (normaly true, if containsPoint returns true)
bool wantsGrab(int x, int y) {return containsPointInComponentCoords(x-m_x, y-m_y);}
......
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