You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef SACOLORPALETTEGRIDWIDGET_H
#define SACOLORPALETTEGRIDWIDGET_H
#include <QWidget>
#include "SAColorWidgetsGlobal.h"
class QMenu;
class SAColorToolButton;
/**
* @brief 类似office的颜色选择窗口有一排标准色下面有一个颜色板有3行浅色有2行深色
*/
class SA_COLOR_WIDGETS_API SAColorPaletteGridWidget : public QWidget
{
Q_OBJECT
SA_COLOR_WIDGETS_DECLARE_PRIVATE(SAColorPaletteGridWidget)
public:
SAColorPaletteGridWidget(QWidget* par = nullptr);
SAColorPaletteGridWidget(const QList< QColor >& cls, QWidget* par = nullptr);
~SAColorPaletteGridWidget();
// 设置窗口维护的colorList
void setColorList(const QList< QColor >& cls);
QList< QColor > colorList() const;
// 设置颜色深浅比例factor默认为{ 180, 160, 140, 75, 50 }
void setFactor(const QList< int >& factor);
QList< int > factor() const;
// 设置iconsize
void setColorIconSize(const QSize& s);
QSize colorIconSize() const;
// 设置颜色是否是checkable
void setColorCheckable(bool on = true);
bool isColorCheckable() const;
private slots:
void onMainColorClicked(const QColor& c);
void onPaletteColorClicked(const QColor& c);
private:
void init();
signals:
/**
* @brief 对于check模式check的颜色触发的信号
* @param c
* @param on
*/
void colorClicked(const QColor& c);
};
#endif // SACOLORPALETTEGRIDWIDGET_H