diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector.cpp b/plugins/dockers/advancedcolorselector/kis_color_selector.cpp --- a/plugins/dockers/advancedcolorselector/kis_color_selector.cpp +++ b/plugins/dockers/advancedcolorselector/kis_color_selector.cpp @@ -256,6 +256,7 @@ m_grabbingComponent=m_subComponent; mouseEvent(e); + updatePreviousColorPreview(); e->accept(); } } @@ -280,6 +281,7 @@ m_lastColorRole = Acs::buttonToRole(e->button()); updateColor(m_lastRealColor, m_lastColorRole, false); + updateBaseColorPreview(m_currentRealColor); e->accept(); } diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_base.h b/plugins/dockers/advancedcolorselector/kis_color_selector_base.h --- a/plugins/dockers/advancedcolorselector/kis_color_selector_base.h +++ b/plugins/dockers/advancedcolorselector/kis_color_selector_base.h @@ -55,6 +55,8 @@ void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset); void updateColorPreview(const KoColor &color); void showColorPreview(); + void updateBaseColorPreview(const KoColor &color); + void updatePreviousColorPreview(); virtual void setColor(const KoColor& color); diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_base.cpp b/plugins/dockers/advancedcolorselector/kis_color_selector_base.cpp --- a/plugins/dockers/advancedcolorselector/kis_color_selector_base.cpp +++ b/plugins/dockers/advancedcolorselector/kis_color_selector_base.cpp @@ -48,6 +48,8 @@ setWindowFlags(Qt::ToolTip); setQColor(QColor(0,0,0)); setMouseTracking(true); + m_baseColor = Qt::black; + m_previousColor = Qt::black; } void show() @@ -70,7 +72,8 @@ } else { targetPos = QPoint(parentPos.x(), parentPos.y() + m_parent->height()); } - setGeometry(targetPos.x(), targetPos.y(), 100, 100); + setGeometry(targetPos.x(), targetPos.y(), 100, 165); + setAttribute(Qt::WA_TranslucentBackground); } void setQColor(const QColor& color) @@ -79,16 +82,30 @@ update(); } + void setPreviousQColor() + { + m_previousColor = m_baseColor; + } + + void setBaseQColor(const QColor& color) + { + m_baseColor = color; + update(); + } + protected: void paintEvent(QPaintEvent *e) { Q_UNUSED(e); QPainter p(this); - p.fillRect(0,0, width(), width(), m_color); + p.fillRect(0, 0, width(), width(), m_color); + p.fillRect(35, width(), width(), height(), m_previousColor); } private: KisColorSelectorBase* m_parent; QColor m_color; + QColor m_baseColor; + QColor m_previousColor; }; KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : @@ -426,6 +443,16 @@ m_colorPreviewPopup->setQColor(converter()->toQColor(color)); } +void KisColorSelectorBase::updateBaseColorPreview(const KoColor &color) +{ + m_colorPreviewPopup->setBaseQColor(converter()->toQColor(color)); +} + +void KisColorSelectorBase::updatePreviousColorPreview() +{ + m_colorPreviewPopup->setPreviousQColor(); +} + void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) { if (key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) {