ClickLabel: rename clicked to leftClicked and only fire when left mouse button clicked
This commit is contained in:
szülő
f975a40ddd
commit
8d6ee157a7
@ -1,6 +1,11 @@
|
|||||||
|
#include <QMouseEvent>
|
||||||
#include "clicklabel.h"
|
#include "clicklabel.h"
|
||||||
|
|
||||||
void ClickLabel::mousePressEvent(QMouseEvent *event)
|
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:
|
public:
|
||||||
using QLabel::QLabel;
|
using QLabel::QLabel;
|
||||||
signals:
|
signals:
|
||||||
void clicked();
|
void leftClick();
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void MainWindow::pdfPreviewReceived(PdfPreview preview)
|
|||||||
label->setPixmap(QPixmap::fromImage(preview.previewImage));
|
label->setPixmap(QPixmap::fromImage(preview.previewImage));
|
||||||
label->setToolTip(preview.documentPath);
|
label->setToolTip(preview.documentPath);
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(label);
|
ui->scrollAreaWidgetContents->layout()->addWidget(label);
|
||||||
connect(label, &ClickLabel::clicked, [=]() {
|
connect(label, &ClickLabel::leftClick, [=]() {
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
QString command = settings.value("pdfviewer").toString();
|
QString command = settings.value("pdfviewer").toString();
|
||||||
if(command != "" && command.contains("%p") && command.contains("%f"))
|
if(command != "" && command.contains("%p") && command.contains("%f"))
|
||||||
|
Betöltés…
Reference in New Issue
Block a user