summary refs log tree commit diff
path: root/src/dialogs/ImageOverlay.h
blob: 2174279f761668fcaa8517003629a9868b86f317 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QDialog>
#include <QMouseEvent>
#include <QPixmap>
#include <QShortcut>

namespace dialogs {

class ImageOverlay : public QWidget
{
    Q_OBJECT
public:
    ImageOverlay(QPixmap image, QWidget *parent = nullptr);

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void paintEvent(QPaintEvent *event) override;

signals:
    void closing();
    void saving();

private:
    QPixmap originalImage_;
    QPixmap image_;

    QRect content_;
    QRect close_button_;
    QRect save_button_;
    QShortcut *close_shortcut_;
};
} // dialogs