ClickLabel: rename clicked to leftClicked and only fire when left mouse button clicked

This commit is contained in:
Albert S. 2019-04-30 12:40:28 +02:00
父節點 88a6152b52
當前提交 5deb64cd28
共有 3 個文件被更改,包括 8 次插入3 次删除

查看文件

@ -1,6 +1,11 @@
#include <QMouseEvent>
#include "clicklabel.h"
void ClickLabel::mousePressEvent(QMouseEvent *event)
{
emit clicked();
if(event->button() == Qt::LeftButton)
{
emit leftClick();
}
return QLabel::mousePressEvent(event);
}

查看文件

@ -8,7 +8,7 @@ class ClickLabel : public QLabel
public:
using QLabel::QLabel;
signals:
void clicked();
void leftClick();
protected:
void mousePressEvent(QMouseEvent *event);

查看文件

@ -120,7 +120,7 @@ void MainWindow::pdfPreviewReceived(PdfPreview preview)
label->setPixmap(QPixmap::fromImage(preview.previewImage));
label->setToolTip(preview.documentPath);
ui->scrollAreaWidgetContents->layout()->addWidget(label);
connect(label, &ClickLabel::clicked,
connect(label, &ClickLabel::leftClick,
[=]()
{
QSettings settings;