clicklabel: Add right button click signal
Tento commit je obsažen v:
rodič
9ca1809d67
revize
4c2967a547
@ -3,9 +3,13 @@
|
||||
|
||||
void ClickLabel::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit leftClick();
|
||||
}
|
||||
return QLabel::mousePressEvent(event);
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit leftClick();
|
||||
}
|
||||
if(event->button() == Qt::RightButton)
|
||||
{
|
||||
emit rightClick();
|
||||
}
|
||||
return QLabel::mousePressEvent(event);
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
#ifndef CLICKLABEL_H
|
||||
#define CLICKLABEL_H
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
|
||||
class ClickLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QLabel::QLabel;
|
||||
using QLabel::QLabel;
|
||||
signals:
|
||||
void leftClick();
|
||||
void leftClick();
|
||||
void rightClick();
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif // CLICKLABEL_H
|
||||
|
Načítá se…
Odkázat v novém úkolu
Zablokovat Uživatele