clicklabel: Add right button click signal

This commit is contained in:
Albert S. 2021-03-07 21:12:50 +01:00
父節點 9ca1809d67
當前提交 4c2967a547
共有 2 個文件被更改,包括 15 次插入10 次删除

查看文件

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

查看文件

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