Krita Source Code Documentation
Loading...
Searching...
No Matches
KisClickableLabel.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2023 Halla Rempt <halla@valdyas.org>
3 * SPDX-FileCopyrightText: 2023 Alvin Wong <alvin@alvinhc.com>
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef KISCLICKABLELABEL_H
7#define KISCLICKABLELABEL_H
8
9#include <QPixmap>
10#include <QLabel>
11#include <QObject>
12#include <QWidget>
13#include <QPushButton>
14
15#include <kritawidgetutils_export.h>
16
17class KRITAWIDGETUTILS_EXPORT KisClickableLabel : public QLabel
18{
19 Q_OBJECT
20public:
21
22 explicit KisClickableLabel(QWidget *parent = nullptr);
23 ~KisClickableLabel() override;
24
25 bool hasHeightForWidth() const override;
26 int heightForWidth(int w) const override;
27 QSize minimumSizeHint() const override;
28 QSize sizeHint() const override;
29
30 void setUnscaledPixmap(QPixmap pixmap);
31 void updatePixmap();
32
33 void setDismissable(bool value = true);
34 bool isDismissable();
35
36Q_SIGNALS:
37 void clicked();
38 void dismissed();
39
40protected:
41 void mousePressEvent(QMouseEvent* event) override;
42 void resizeEvent(QResizeEvent *event) override;
43
44private:
45 QPixmap m_pixmap;
46
47 bool m_dismissable = false;
48 QPushButton *m_closeButton;
49};
50
51#endif // KISCLICKABLELABEL_H
float value(const T *src, size_t ch)
QPushButton * m_closeButton