clicklabel: Add right button click signal

This commit is contained in:
Albert S. 2021-03-07 21:12:50 +01:00
parent 3fd4e47196
commit d3fe08b64b
2 changed files with 6 additions and 0 deletions

View File

@ -7,5 +7,9 @@ void ClickLabel::mousePressEvent(QMouseEvent *event)
{
emit leftClick();
}
if(event->button() == Qt::RightButton)
{
emit rightClick();
}
return QLabel::mousePressEvent(event);
}

View File

@ -1,6 +1,7 @@
#ifndef CLICKLABEL_H
#define CLICKLABEL_H
#include <QLabel>
#include <QMenu>
class ClickLabel : public QLabel
{
@ -9,6 +10,7 @@ class ClickLabel : public QLabel
using QLabel::QLabel;
signals:
void leftClick();
void rightClick();
protected:
void mousePressEvent(QMouseEvent *event);