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 | m_previousColor = Qt::black; | ||||
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 | setGeometry(targetPos.x(), targetPos.y(), 100, 165); | ||
76 | setAttribute(Qt::WA_TranslucentBackground); | ||||
74 | } | 77 | } | ||
75 | 78 | | |||
76 | void setQColor(const QColor& color) | 79 | void setQColor(const QColor& color) | ||
Context not available. | |||||
79 | update(); | 82 | update(); | ||
80 | } | 83 | } | ||
81 | 84 | | |||
85 | void setPreviousQColor() | ||||
86 | { | ||||
87 | m_previousColor = m_baseColor; | ||||
88 | } | ||||
89 | | ||||
90 | void setBaseQColor(const QColor& color) | ||||
91 | { | ||||
92 | m_baseColor = color; | ||||
93 | update(); | ||||
94 | } | ||||
95 | | ||||
82 | protected: | 96 | protected: | ||
83 | void paintEvent(QPaintEvent *e) { | 97 | void paintEvent(QPaintEvent *e) { | ||
84 | Q_UNUSED(e); | 98 | Q_UNUSED(e); | ||
85 | QPainter p(this); | 99 | QPainter p(this); | ||
86 | p.fillRect(0,0, width(), width(), m_color); | 100 | p.fillRect(0, 0, width(), width(), m_color); | ||
101 | p.fillRect(35, width(), width(), height(), m_previousColor); | ||||
87 | } | 102 | } | ||
88 | 103 | | |||
89 | private: | 104 | private: | ||
90 | KisColorSelectorBase* m_parent; | 105 | KisColorSelectorBase* m_parent; | ||
91 | QColor m_color; | 106 | QColor m_color; | ||
107 | QColor m_baseColor; | ||||
108 | QColor m_previousColor; | ||||
92 | }; | 109 | }; | ||
93 | 110 | | |||
94 | KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : | 111 | KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : | ||
Context not available. | |||||
426 | m_colorPreviewPopup->setQColor(converter()->toQColor(color)); | 443 | m_colorPreviewPopup->setQColor(converter()->toQColor(color)); | ||
427 | } | 444 | } | ||
428 | 445 | | |||
446 | void KisColorSelectorBase::updateBaseColorPreview(const KoColor &color) | ||||
447 | { | ||||
448 | m_colorPreviewPopup->setBaseQColor(converter()->toQColor(color)); | ||||
449 | } | ||||
450 | | ||||
451 | void KisColorSelectorBase::updatePreviousColorPreview() | ||||
452 | { | ||||
453 | m_colorPreviewPopup->setPreviousQColor(); | ||||
454 | } | ||||
455 | | ||||
429 | void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) | 456 | void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) | ||
430 | { | 457 | { | ||
431 | if (key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) { | 458 | if (key == KoCanvasResourceManager::ForegroundColor || key == KoCanvasResourceManager::BackgroundColor) { | ||
Context not available. |