Diffstat (limited to 'core/pim/today/clickablelabel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/clickablelabel.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/pim/today/clickablelabel.cpp b/core/pim/today/clickablelabel.cpp new file mode 100644 index 0000000..6912c34 --- a/dev/null +++ b/core/pim/today/clickablelabel.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include "clickablelabel.h" | ||
2 | |||
3 | ClickableLabel::ClickableLabel(QWidget* parent = 0, | ||
4 | const char* name = 0, | ||
5 | WFlags fl = 0) : | ||
6 | QLabel(parent,name,fl) | ||
7 | { | ||
8 | setFrameShape(NoFrame); | ||
9 | setFrameShadow(Sunken); | ||
10 | } | ||
11 | |||
12 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | ||
13 | setFrameShape(Panel); | ||
14 | repaint(); | ||
15 | } | ||
16 | |||
17 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | ||
18 | setFrameShape(NoFrame); | ||
19 | repaint(); | ||
20 | if (rect().contains(e->pos())) { | ||
21 | emit clicked(); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | ||
26 | if (rect().contains(e->pos())) { | ||
27 | setFrameShape(Panel); | ||
28 | } else { | ||
29 | setFrameShape(NoFrame); | ||
30 | } | ||
31 | } | ||