Changeset View
Changeset View
Standalone View
Standalone View
plugins/dockers/advancedcolorselector/kis_color_selector_base.cpp
Context not available. | |||||
48 | setWindowFlags(Qt::ToolTip); | 48 | setWindowFlags(Qt::ToolTip); | ||
---|---|---|---|---|---|
49 | setQColor(QColor(0,0,0)); | 49 | setQColor(QColor(0,0,0)); | ||
50 | setMouseTracking(true); | 50 | setMouseTracking(true); | ||
51 | m_baseColor = Qt::black; | ||||
52 | | ||||
51 | } | 53 | } | ||
52 | 54 | | |||
53 | void show() | 55 | void show() | ||
Context not available. | |||||
70 | } else { | 72 | } else { | ||
71 | targetPos = QPoint(parentPos.x(), parentPos.y() + m_parent->height()); | 73 | targetPos = QPoint(parentPos.x(), parentPos.y() + m_parent->height()); | ||
72 | } | 74 | } | ||
73 | setGeometry(targetPos.x(), targetPos.y(), 100, 100); | 75 | | ||
76 | setGeometry(targetPos.x(), targetPos.y(), 100, 165); | ||||
77 | setWindowFlags(Qt::FramelessWindowHint); | ||||
78 | setAttribute(Qt::WA_TranslucentBackground); | ||||
74 | } | 79 | } | ||
75 | 80 | | |||
76 | void setQColor(const QColor& color) | 81 | void setQColor(const QColor& color) | ||
Context not available. | |||||
79 | update(); | 84 | update(); | ||
80 | } | 85 | } | ||
81 | 86 | | |||
87 | void setbaseQColor(const QColor& color) | ||||
88 | { | ||||
89 | m_previosColor = m_baseColor; | ||||
90 | m_baseColor = color; | ||||
91 | update(); | ||||
92 | } | ||||
93 | | ||||
82 | protected: | 94 | protected: | ||
83 | void paintEvent(QPaintEvent *e) { | 95 | void paintEvent(QPaintEvent *e) { | ||
84 | Q_UNUSED(e); | 96 | Q_UNUSED(e); | ||
85 | QPainter p(this); | 97 | QPainter p(this); | ||
86 | p.fillRect(0,0, width(), width(), m_color); | 98 | p.fillRect(0, 0, width(), width(), m_color); | ||
99 | p.fillRect(35, width(), width(), height(), m_previosColor); | ||||
100 | | ||||
87 | } | 101 | } | ||
88 | 102 | | |||
89 | private: | 103 | private: | ||
90 | KisColorSelectorBase* m_parent; | 104 | KisColorSelectorBase* m_parent; | ||
91 | QColor m_color; | 105 | QColor m_color; | ||
106 | QColor m_baseColor; | ||||
107 | QColor m_previosColor; | ||||
92 | }; | 108 | }; | ||
93 | 109 | | |||
94 | KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : | 110 | KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : | ||
Context not available. | |||||
426 | m_colorPreviewPopup->setQColor(converter()->toQColor(color)); | 442 | m_colorPreviewPopup->setQColor(converter()->toQColor(color)); | ||
427 | } | 443 | } | ||
428 | 444 | | |||
445 | void KisColorSelectorBase::updateBaseColorPreview(const KoColor &color) | ||||
446 | { | ||||
447 | m_colorPreviewPopup->setbaseQColor(converter()->toQColor(color)); | ||||
448 | } | ||||
449 | | ||||
429 | void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) | 450 | void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) | ||
430 | { | 451 | { | ||
431 | if (key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) { | 452 | if (key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) { | ||
Context not available. |