SARibbon 2.5.2
SARibbon wiki
载入中...
搜索中...
未找到
SAColorGridWidget.h
1#ifndef SACOLORGRIDWIDGET_H
2#define SACOLORGRIDWIDGET_H
3#include <QWidget>
4#include <functional>
5#include "SAColorWidgetsGlobal.h"
6class QAbstractButton;
25class SA_COLOR_WIDGETS_API SAColorGridWidget : public QWidget
26{
27 Q_OBJECT
28 SA_COLOR_WIDGETS_DECLARE_PRIVATE(SAColorGridWidget)
29 Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
30public:
31 using FunColorBtn = std::function< void(SAColorToolButton*) >;
32
33public:
35 SAColorGridWidget(QWidget* par = nullptr);
39 void setColumnCount(int c);
41 int columnCount() const;
43 void setColorList(const QList< QColor >& cls);
45 QList< QColor > getColorList() const;
47 int spacing() const;
49 void setSpacing(int v);
51 int colorCount() const;
53 void setColorIconSize(const QSize& s);
55 QSize colorIconSize() const;
57 void setColorCheckable(bool on = true);
59 bool isColorCheckable() const;
61 QColor currentCheckedColor() const;
63 SAColorToolButton* colorButton(int index) const;
65 void setVerticalSpacing(int v);
67 int verticalSpacing() const;
69 void setHorizontalSpacing(int v);
71 int horizontalSpacing() const;
73 void clearCheckedState();
75 void iterationColorBtns(FunColorBtn fn);
77 void setRowMinimumHeight(int row, int minSize);
79 void setHorizontalSpacerToRight(bool on = true);
80private Q_SLOTS:
81 void onButtonClicked(QAbstractButton* btn);
82 void onButtonPressed(QAbstractButton* btn);
83 void onButtonReleased(QAbstractButton* btn);
84 void onButtonToggled(QAbstractButton* btn, bool on);
85
86Q_SIGNALS:
98 void colorClicked(const QColor& c);
99
111 void colorPressed(const QColor& c);
112
124 void colorReleased(const QColor& c);
125
139 void colorToggled(const QColor& c, bool on);
140
141public:
143 virtual QSize sizeHint() const Q_DECL_OVERRIDE;
144};
145namespace SA
146{
148SA_COLOR_WIDGETS_API QList< QColor > getStandardColorList();
149}
150#endif // SACOLORGRIDWIDGET_H
Definition SAColorGridWidget.h:26
void colorToggled(const QColor &c, bool on)
void colorClicked(const QColor &c)
void colorReleased(const QColor &c)
void colorPressed(const QColor &c)
这是一个只显示颜色的toolbutton
Definition SAColorToolButton.h:41