Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef qclickablelabelhincluded
00020 #define qclickablelabelhincluded
00021
00022 #include <QLabel>
00023 #include "QmitkExtExports.h"
00024
00025 #include <vector>
00026 #include <map>
00027
00028 #include "mitkCommon.h"
00029
00036 class QmitkExt_EXPORT QClickableLabel : public QLabel
00037 {
00038 Q_OBJECT
00039
00040 public:
00041
00042 QClickableLabel( QWidget* parent, Qt::WFlags f = 0 );
00043 QClickableLabel( const QString& text, QWidget* parent, Qt::WFlags f = 0 );
00044 virtual ~QClickableLabel();
00045
00046 void AddHotspot( const QString& name, const QRect position );
00047
00048 void RemoveHotspot( const QString& name );
00049 void RemoveHotspot( unsigned int hotspotIndex );
00050 void RemoveAllHotspots();
00051
00052 signals:
00053
00054 void mousePressed( const QString& hotspotName );
00055 void mousePressed( unsigned int hotspotIndex );
00056 void mouseReleased( const QString& hotspotName );
00057 void mouseReleased( unsigned int hotspotIndex );
00058
00059 protected:
00060
00061 virtual void mousePressEvent ( QMouseEvent* e );
00062 virtual void mouseReleaseEvent ( QMouseEvent* e );
00063
00065 unsigned int matchingRect( const QPoint& p );
00066
00067 typedef std::vector< QRect > RectVectorType;
00068 RectVectorType m_Hotspots;
00069
00070 typedef std::map< QString, unsigned int > NameToIndexMapType;
00071 typedef std::map< unsigned int, QString > IndexToNameMapType;
00072 NameToIndexMapType m_HotspotIndexForName;
00073 IndexToNameMapType m_HotspotNameForIndex;
00074
00075 };
00076
00077 #endif
00078