configpanelbutton.h
1.28 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef CONFIGPANELBUTTON_H
#define CONFIGPANELBUTTON_H
#include <QWidget>
namespace Ui {
class ConfigPanelButton;
}
class ConfigPanelButton : public QWidget
{
Q_OBJECT
public:
explicit ConfigPanelButton(QWidget *parent = 0,uint16_t id = 0);
~ConfigPanelButton();
const QString &text() { return text_; }
const QString &value() { return value_; }
bool isFavoriteFocused();
QWidget* getFavoriteBtn();
QWidget* getBtn();
public slots:
void setText(const QString &text);
void setValue(const QString &value);
void showFavoriteButton();
void hideFavoriteButton();
bool isFavoriteChecked();
void setFavoriteCheck(bool checked);
protected:
void focusInEvent(QFocusEvent *event);
private:
Ui::ConfigPanelButton *ui;
QString text_;
QString value_;
QRect textRect;
QRect valueRect;
bool showingFavoriteButton;
bool isFavorited;
uint16_t btnid;
private slots:
void updateIcon();
void on_favoriteButton_clicked(bool checked);
void on_pushButton_clicked();
void on_pushButton_released();
void on_pushButton_pressed();
signals:
void pressed(uint16_t);
void released(uint16_t);
void clicked(uint16_t);
void checkButtonClicked(uint16_t, bool checked);
};
#endif // CONFIGPANELBUTTON_H