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. | |||||
78 | m_color = color; | 82 | m_color = color; | ||
79 | update(); | 83 | update(); | ||
80 | } | 84 | } | ||
85 | void setbaseQColor(const QColor& color) | ||||
86 | { | ||||
87 | m_previosColor = m_baseColor; | ||||
88 | m_baseColor = color; | ||||
89 | update(); | ||||
90 | } | ||||
81 | 91 | | |||
82 | protected: | 92 | protected: | ||
83 | void paintEvent(QPaintEvent *e) { | 93 | void paintEvent(QPaintEvent *e) { | ||
84 | Q_UNUSED(e); | 94 | Q_UNUSED(e); | ||
85 | QPainter p(this); | 95 | QPainter p(this); | ||
86 | p.fillRect(0,0, width(), width(), m_color); | 96 | p.fillRect(0,0, width(), width(), m_color); | ||
97 | p.fillRect(35,width(), width(),height(), m_previosColor); | ||||
87 | } | 98 | } | ||
88 | 99 | | |||
89 | private: | 100 | private: | ||
90 | KisColorSelectorBase* m_parent; | 101 | KisColorSelectorBase* m_parent; | ||
91 | QColor m_color; | 102 | QColor m_color; | ||
103 | QColor m_baseColor; | ||||
104 | QColor m_previosColor; | ||||
92 | }; | 105 | }; | ||
93 | 106 | | |||
94 | KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : | 107 | KisColorSelectorBase::KisColorSelectorBase(QWidget *parent) : | ||
Context not available. | |||||
170 | m_canvas = 0; | 183 | m_canvas = 0; | ||
171 | } | 184 | } | ||
172 | 185 | | |||
173 | | ||||
174 | | ||||
175 | void KisColorSelectorBase::mousePressEvent(QMouseEvent* event) | 186 | void KisColorSelectorBase::mousePressEvent(QMouseEvent* event) | ||
176 | { | 187 | { | ||
177 | event->accept(); | 188 | event->accept(); | ||
Context not available. | |||||
425 | { | 436 | { | ||
426 | m_colorPreviewPopup->setQColor(converter()->toQColor(color)); | 437 | m_colorPreviewPopup->setQColor(converter()->toQColor(color)); | ||
427 | } | 438 | } | ||
439 | void KisColorSelectorBase::updateBaseColorPreview(const KoColor &color) | ||||
440 | { | ||||
441 | m_colorPreviewPopup->setbaseQColor(converter()->toQColor(color)); | ||||
442 | } | ||||
428 | 443 | | |||
429 | void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) | 444 | void KisColorSelectorBase::canvasResourceChanged(int key, const QVariant &v) | ||
430 | { | 445 | { | ||
Context not available. |