aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_fomod_plus/installer/ui/ClickableWidget.h
blob: 881600f4554998a6fecf3a9e5b471bf35d3312c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <QMouseEvent>
#include <QWidget>

class ClickableWidget final : public QWidget {
    Q_OBJECT

public:
    explicit ClickableWidget(QWidget* parent = nullptr) : QWidget(parent) {
        setCursor(Qt::PointingHandCursor);
    }

    signals:
        void clicked();

protected:
    void mousePressEvent(QMouseEvent* event) override {
        if (event->button() == Qt::LeftButton) {
            emit clicked();
        }
        QWidget::mousePressEvent(event);
    }
};