32 lines
726 B
C++
32 lines
726 B
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
|
|
|
#pragma once
|
|
|
|
#include <QWidget>
|
|
|
|
class ColorPicker : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit ColorPicker(QWidget* parent = nullptr);
|
|
|
|
signals:
|
|
void colorSelected(QColor c);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent* event) override;
|
|
void repaint(int i, QPainter& painter);
|
|
void mouseMoveEvent(QMouseEvent*) override;
|
|
void showEvent(QShowEvent* event) override;
|
|
void hideEvent(QHideEvent* event) override;
|
|
|
|
private:
|
|
int m_colorAreaSize;
|
|
int m_selectedIndex, m_lastIndex;
|
|
QVector<QRect> m_colorAreaList;
|
|
QVector<QColor> m_colorList;
|
|
|
|
QColor m_uiColor;
|
|
};
|