-
Notifications
You must be signed in to change notification settings - Fork 0
/
glcombobox.h
80 lines (55 loc) · 1.32 KB
/
glcombobox.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef GLCOMBOBOX_H
#define GLCOMBOBOX_H
#include "globject.h"
#include <QRect>
class GlComboBoxItem : public GlObject
{
Q_OBJECT
private:
QString text;
public:
GlComboBoxItem(GlObject* parent = 0);
QString getText() { return text; }
void mouseReleaseEvent ( QMouseEvent * event );
void setText(QString t) { text = t; }
signals:
void clicked(QString);
};
class GlComboBox : public GlObject
{
Q_OBJECT
private:
QColor gradientColorAt0;
QColor gradientColorAt1;
QColor borderColor;
QColor fontColor;
QPen pen;
QRect orgRect;
int border;
int borderRadius;
int fontSize;
int itemHeight;
int closedHeight;
//int orgY;
bool isOpen;
bool expandUp;
bool fill;
QList<GlComboBoxItem*> list;
public:
int orgY;
GlComboBox(GlObject* parent = 0);
void clear();
void draw(QPainter *p);
void insertItem(QString text);
void mouseReleaseEvent ( QMouseEvent * event );
void setGeometry(int posX, int posY, int w, int h);
QString getText() { return list.first()->getText(); }
void setFill(bool f) { fill = f; }
void setFirstText(QString s) { list.first()->setText(s); }
public slots:
void itemClicked(QString);
signals:
void open(GlComboBox*);
void closed(GlComboBox*);
};
#endif // GLCOMBOBOX_H