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//======================
27class ClickableLabel : public QLabel
28{
29Q_OBJECT
30//----------------------
31public:
32 ClickableLabel( QWidget *parent=0, const char* name=0);
33 void setInvisible( bool val );
34//----------------------
35protected:
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 //----------------------
46public slots:
47 void setEnabled( bool val );
48 void setPixmap( const QPixmap &p );
49//----------------------
50signals:
51 void clicked();
52//----------------------
53private:
54 //redraws label using an "active" pixmap
55 void setActive();
56
57 //redraws label using a "hightlighted" pixmap
58 void setHighlighted();
59
61 bool enabled;
63 bool pressed;
64//----------------------
65};
66//======================
67
68#endif //GUI_CLICKABLELABEL_H
A clickable label.
void mouseMoveEvent(QMouseEvent *e)
void mouseReleaseEvent(QMouseEvent *e)
void mousePressEvent(QMouseEvent *)
void paintEvent(QPaintEvent *e)
double buffer to avoid flicker
QPixmap defaultPixmap
ClickableLabel(QWidget *parent=0, const char *name=0)
void setInvisible(bool val)
void leaveEvent(QEvent *)
void setEnabled(bool val)
void enterEvent(QEvent *)
void setPixmap(const QPixmap &p)