AlbumShaper  1.0a3
clickableLabel.h
Go to the documentation of this file.
1 //==============================================
2 // copyright : (C) 2003-2005 by Will Stokes
3 //==============================================
4 // This program is free software; you can redistribute it
5 // and/or modify it under the terms of the GNU General
6 // Public License as published by the Free Software
7 // Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //==============================================
10 
11 #ifndef GUI_CLICKABLELABEL_H
12 #define GUI_CLICKABLELABEL_H
13 
14 #include <qlabel.h>
15 #include <qpixmap.h>
16 //Added by qt3to4:
17 #include <QPaintEvent>
18 #include <QMouseEvent>
19 #include <QEvent>
20 
21 //=====================================
24 //=====================================
25 
26 //======================
27 class ClickableLabel : public QLabel
28 {
29 Q_OBJECT
30 //----------------------
31 public:
32  ClickableLabel( QWidget *parent=0, const char* name=0);
33  void setInvisible( bool val );
34 //----------------------
35 protected:
37  void paintEvent( QPaintEvent *e );
38 
39  void enterEvent ( QEvent * );
40  void leaveEvent ( QEvent * );
41 
42  void mouseMoveEvent( QMouseEvent* e );
43  void mousePressEvent ( QMouseEvent * );
44  void mouseReleaseEvent ( QMouseEvent * e );
45  //----------------------
46 public slots:
47  void setEnabled( bool val );
48  void setPixmap( const QPixmap &p );
49 //----------------------
50 signals:
51  void clicked();
52 //----------------------
53 private:
54  //redraws label using an "active" pixmap
55  void setActive();
56 
57  //redraws label using a "hightlighted" pixmap
58  void setHighlighted();
59 
60  QPixmap defaultPixmap;
61  bool enabled;
62  bool invisible;
63  bool pressed;
64 //----------------------
65 };
66 //======================
67 
68 #endif //GUI_CLICKABLELABEL_H
void leaveEvent(QEvent *)
void mouseMoveEvent(QMouseEvent *e)
void setPixmap(const QPixmap &p)
A clickable label.
QPixmap defaultPixmap
void paintEvent(QPaintEvent *e)
double buffer to avoid flicker
void setEnabled(bool val)
void mouseReleaseEvent(QMouseEvent *e)
void enterEvent(QEvent *)
void mousePressEvent(QMouseEvent *)
ClickableLabel(QWidget *parent=0, const char *name=0)
void setInvisible(bool val)