Skip to content

Instantly share code, notes, and snippets.

@jjfajardo
Created June 11, 2014 14:46
Show Gist options
  • Save jjfajardo/545e72dae11ca6d7b6d8 to your computer and use it in GitHub Desktop.
Save jjfajardo/545e72dae11ca6d7b6d8 to your computer and use it in GitHub Desktop.
LinkLabel
#include "linklabel.h"
#include <QtWidgets>
LinkLabel::LinkLabel(QWidget * parent)
:QLabel(parent)
{
connect( this, SIGNAL( clicked() ), this, SLOT( slotClicked() ) );
}
void LinkLabel::slotClicked()
{
qDebug()<<"Clicked";
}
void LinkLabel::mousePressEvent ( QMouseEvent * event )
{
emit clicked();
}
#ifndef LINKLABEL_H
#define LINKLABEL_H
#include <QLabel>
class LinkLabel : public QLabel
{
Q_OBJECT
public:
LinkLabel(QWidget * parent = 0 );
~LinkLabel(){}
signals:
void clicked();
public slots:
void slotClicked();
protected:
void mousePressEvent ( QMouseEvent * event ) ;
};
#endif // LINKLABEL_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment