Debian Codegraph @

src/album/widgets/imagebutton.h

raw
1 /*
2 * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd.
3 *
4 * Author: ZhangYong <[email protected]>
5 *
6 * Maintainer: ZhangYong <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #ifndef IMAGEBUTTON_H
22 #define IMAGEBUTTON_H
23
24 #include <QEvent>
25 #include <QLabel>
26
27 #include "controller/viewerthememanager.h"
28 #include <dimagebutton.h>
29
30 using namespace Dtk::Widget;
31
32 class QLabel;
33 class ImageButton : public DImageButton
34 {
35 Q_OBJECT
36 // Q_PROPERTY(QString disablePic READ getDisablePic WRITE setDisablePic
37 // DESIGNABLE true)
38 public:
39 explicit ImageButton(QWidget *parent = nullptr);
40 explicit ImageButton(const QString &normalPic, const QString &hoverPic,
41 const QString &pressPic, const QString &disablePic,
42 QWidget *parent = nullptr);
43
44 // void setDisablePic(const QString &path);
45 void setDisabled(bool d);
46
47 void setTooltipVisible(bool visible);
48 // bool tooltipVisible();
49
50 inline const QString getDisablePic() const
51 {
52 return m_disablePic_;
53 }
54 signals:
55 void mouseLeave();
56
57 protected:
58 void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
59 bool event(QEvent *e) Q_DECL_OVERRIDE;
60
61 private:
62 void showTooltip(const QPoint &gPos);
63 void onThemeChanged(ViewerThemeManager::AppTheme theme);
64 private:
65 bool m_tooltipVisiable;
66 QString m_disablePic_;
67 };
68
69 #endif // IMAGEBUTTON_H