-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathqqtsvgpushbutton.h
55 lines (43 loc) · 1.41 KB
/
qqtsvgpushbutton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef QQTSVGPUSHBUTTON_H
#define QQTSVGPUSHBUTTON_H
#include <qqtpushbutton.h>
#include <QSvgRenderer>
#include <qqtwidgets.h>
#include <qqt-local.h>
#include <qqtcore.h>
class QQTSHARED_EXPORT QQtSvgPushButton : public QQtPushButton
{
Q_OBJECT
public:
explicit QQtSvgPushButton ( QWidget* parent = nullptr );
virtual ~QQtSvgPushButton() {}
QString stateImage ( int index );
void setStateImage ( int index, const QString& image );
//normal, press; uncheck, check; [0,1];
void setNormalImage ( const QString& normal, const QString& press );
//hover; [2];
void setHoverImage ( const QString& hover );
//disable; [4];
void setDisableImage ( const QString& disable );
//svg控件使用iconTable,必须render。
const TBtnIconTable& iconTable() const;
TBtnIconTable& iconTable();
/**
* @brief renderToVariable
* call this function after iconTable() set.
*/
void renderToVariable();
protected:
//QQt基础Widget把这个函数作为把状态图设置进入当前图,
//svgwidgets重新实现这个函数,把状态图render进入svgRender,和父类的函数工作位置不一样。
virtual void translateImage();
signals:
public slots:
// QWidget interface
protected:
virtual void paintEvent ( QPaintEvent* event ) override;
private:
QSvgRenderer r[BTN_MAX];
TBtnIconTable mIconTable;
};
#endif // QQTSVGPUSHBUTTON_H