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