Medical Imaging Interaction Toolkit  2023.12.99-7a59bd54
Medical Imaging Interaction Toolkit
QClickableLabel Class Reference

A QLabel with multiple hotspots, that can be clicked. More...

#include <qclickablelabel.h>

Inheritance diagram for QClickableLabel:
Collaboration diagram for QClickableLabel:

Signals

void mousePressed (const QString &hotspotName)
 
void mousePressed (unsigned int hotspotIndex)
 
void mouseReleased (const QString &hotspotName)
 
void mouseReleased (unsigned int hotspotIndex)
 

Public Member Functions

 QClickableLabel (QWidget *parent, Qt::WindowFlags f={})
 
 QClickableLabel (const QString &text, QWidget *parent, Qt::WindowFlags f={})
 
 ~QClickableLabel () override
 
void AddHotspot (const QString &name, const QRect position)
 
void RemoveHotspot (const QString &name)
 
void RemoveHotspot (unsigned int hotspotIndex)
 
void RemoveAllHotspots ()
 

Protected Types

typedef std::vector< QRect > RectVectorType
 
typedef std::map< QString, unsigned int > NameToIndexMapType
 
typedef std::map< unsigned int, QString > IndexToNameMapType
 

Protected Member Functions

void mousePressEvent (QMouseEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
unsigned int matchingRect (const QPoint &p)
 returns index == m_Hotspots.size() if nothing is hit More...
 

Protected Attributes

RectVectorType m_Hotspots
 
NameToIndexMapType m_HotspotIndexForName
 
IndexToNameMapType m_HotspotNameForIndex
 

Detailed Description

A QLabel with multiple hotspots, that can be clicked.

Specially useful in connection with a pixmap. Stretched images should be avoided, because the hotspots will not be adjusted in any way.

Definition at line 30 of file qclickablelabel.h.

Member Typedef Documentation

◆ IndexToNameMapType

typedef std::map<unsigned int, QString> QClickableLabel::IndexToNameMapType
protected

Definition at line 63 of file qclickablelabel.h.

◆ NameToIndexMapType

typedef std::map<QString, unsigned int> QClickableLabel::NameToIndexMapType
protected

Definition at line 62 of file qclickablelabel.h.

◆ RectVectorType

typedef std::vector<QRect> QClickableLabel::RectVectorType
protected

Definition at line 59 of file qclickablelabel.h.

Constructor & Destructor Documentation

◆ QClickableLabel() [1/2]

QClickableLabel::QClickableLabel ( QWidget *  parent,
Qt::WindowFlags  f = {} 
)

◆ QClickableLabel() [2/2]

QClickableLabel::QClickableLabel ( const QString &  text,
QWidget *  parent,
Qt::WindowFlags  f = {} 
)

◆ ~QClickableLabel()

QClickableLabel::~QClickableLabel ( )
override

Member Function Documentation

◆ AddHotspot()

void QClickableLabel::AddHotspot ( const QString &  name,
const QRect  position 
)

◆ matchingRect()

unsigned int QClickableLabel::matchingRect ( const QPoint &  p)
protected

returns index == m_Hotspots.size() if nothing is hit

◆ mousePressed [1/2]

void QClickableLabel::mousePressed ( const QString &  hotspotName)
signal

◆ mousePressed [2/2]

void QClickableLabel::mousePressed ( unsigned int  hotspotIndex)
signal

◆ mousePressEvent()

void QClickableLabel::mousePressEvent ( QMouseEvent *  e)
overrideprotected

◆ mouseReleased [1/2]

void QClickableLabel::mouseReleased ( const QString &  hotspotName)
signal

◆ mouseReleased [2/2]

void QClickableLabel::mouseReleased ( unsigned int  hotspotIndex)
signal

◆ mouseReleaseEvent()

void QClickableLabel::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

◆ RemoveAllHotspots()

void QClickableLabel::RemoveAllHotspots ( )

◆ RemoveHotspot() [1/2]

void QClickableLabel::RemoveHotspot ( const QString &  name)

◆ RemoveHotspot() [2/2]

void QClickableLabel::RemoveHotspot ( unsigned int  hotspotIndex)

Member Data Documentation

◆ m_HotspotIndexForName

NameToIndexMapType QClickableLabel::m_HotspotIndexForName
protected

Definition at line 64 of file qclickablelabel.h.

◆ m_HotspotNameForIndex

IndexToNameMapType QClickableLabel::m_HotspotNameForIndex
protected

Definition at line 65 of file qclickablelabel.h.

◆ m_Hotspots

RectVectorType QClickableLabel::m_Hotspots
protected

Definition at line 60 of file qclickablelabel.h.


The documentation for this class was generated from the following file: