DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DABrushStyleComboBox.h
1#ifndef DABRUSHSTYLECOMBOBOX_H
2#define DABRUSHSTYLECOMBOBOX_H
3#include "DACommonWidgetsAPI.h"
4#include <QComboBox>
5#include <QAbstractItemDelegate>
6#include <QBrush>
7#include <QGradient>
8#include <QPixmap>
9namespace DA
10{
15class DACOMMONWIDGETS_API DABrushStyleComboBox : public QComboBox
16{
17 Q_OBJECT
18 DA_DECLARE_PRIVATE(DABrushStyleComboBox)
19public:
20 // 默认构造以ShowNoBrushStyle|ShowPaintStyle构造,基本颜色为黑色
21 DABrushStyleComboBox(QWidget* parent = Q_NULLPTR);
23 // 画笔样式转换为字符串
24 static QString brushStyleToString(Qt::BrushStyle s);
25 // 显示无画刷
26 void setShowNoBrushStyle(bool v);
27 bool isShowNoBrushStyle() const;
28 // 设置画刷颜色,此设置会影响ShowPaintStyle
29 bool isColorBrush() const;
30 void setBrushColor(const QColor& v);
31 QColor getBrushColor() const;
32 // 重建item
33 void rebuildItems();
34 // 生成icon
35 QIcon generateBrushStyleIcon(Qt::BrushStyle s);
36 // 更新icon
37 void updateIcons();
38 // 是否在样式上显示文字
39 void setStyleTextVisible(bool on);
40 bool isStyleTextVisible() const;
41 // 获取当前的画刷样式
42 Qt::BrushStyle getCurrentBrushStyle() const;
43 // 获取画刷样式
44 Qt::BrushStyle getBrushStyle(int index) const;
45public slots:
46 // 设置当前的样式 此函数会发射currentBrushStyleChanged信号
47 void setCurrentBrushStyle(Qt::BrushStyle s);
48signals:
53 void currentBrushStyleChanged(Qt::BrushStyle s);
54private slots:
55 // 原信号对应的槽
56 void onCurrentIndexChanged(int index);
57
58protected:
59 void addItem(Qt::BrushStyle s);
60
61private:
62};
63}
64
65#endif // DABRUSHSTYLECOMBOBOX_H
Qt::BrushStyle for QComboBox
Definition DABrushStyleComboBox.h:16
void currentBrushStyleChanged(Qt::BrushStyle s)
画刷样式发生变更
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44