Debian Codegraph @

src/album/widgets/expansionpanel.h

raw
1 /*
2 * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd.
3 *
4 * Author: Ji XiangLong <[email protected]>
5 *
6 * Maintainer: WangYu <[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 EXPANSIONPANEL_H
22 #define EXPANSIONPANEL_H
23
24 #include "toolbutton.h"
25
26 #include <QVBoxLayout>
27 #include <QGraphicsDropShadowEffect>
28 #include <DBlurEffectWidget>
29 #include <DToolButton>
30 #include <DWidget>
31 #include <DGuiApplicationHelper>
32 #include <QMap>
33
34 #include "albumgloabl.h"
35
36 class ExpansionPanel : public DBlurEffectWidget
37 {
38 Q_OBJECT
39 public:
40 //所选数据
41 struct FilteData {
42 QIcon icon_l = QIcon();//左边图标
43 QIcon icon_r = QIcon();//右边图标
44 QString icon_r_path;
45 QString text;
46 ItemType type = ItemType::ItemTypeNull;
47 };
48
49 public:
50 /**
51 * @brief ExpansionPanel 构造函数
52 * @param parent
53 */
54 explicit ExpansionPanel(QWidget *parent = nullptr);
55
56 /**
57 * @brief getUngroupButton 主题颜色改变
58 * @param parent
59 */
60 void changeTheme(Dtk::Gui::DGuiApplicationHelper::ColorType themeType);
61
62 //动态添加按钮
63 void addNewButton(FilteData &data);
64
65 signals:
66 /**
67 * @description: signalItemGroup 组合框选图元信号
68 */
69 void signalItemGroup();
70
71
72 /**
73 * @description: signalItemGroup 释放组合框选图元信号
74 */
75 void signalItemgUngroup();
76
77 void currentItemChanged(FilteData &data);
78
79 protected:
80 void focusOutEvent(QFocusEvent *e) override;
81
82 private slots:
83 void onButtonClicked(FilteData data);
84
85 private:
86 //阴影背景
87 QGraphicsDropShadowEffect *shadow_effect = nullptr;
88 //内置按钮组
89 QMap<int, ToolButton *> buttons;
90 //按钮数量
91 int buttonCount = 0;
92 //主图层
93 QVBoxLayout *layout;
94 };
95 Q_DECLARE_METATYPE(ExpansionPanel::FilteData)
96 #endif // EXPANSIONPANEL_H