Debian Codegraph @

kysdk-qtwidgets/src/kdirtabbar.h

raw
1 /*
2 * libkysdk-qtwidgets's Library
3 *
4 * Copyright (C) 2024, KylinSoft Co., Ltd.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this library. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Authors: Yaxian Liu <[email protected]>
20 *
21 */
22
23 #ifndef KDIRTABBAR_H
24 #define KDIRTABBAR_H
25
26 #include <QToolButton>
27 #include <QWidget>
28
29 namespace kdk
30 {
31
32 class KDirTabBarPrivate;
33
34 /**
35 * @brief 目录层级控件
36 * @since 2.5.2.0
37 */
38 class KDirTabBar : public QWidget
39 {
40 Q_OBJECT
41 public:
42 KDirTabBar(QWidget *parent = nullptr);
43 ~KDirTabBar();
44
45 /**
46 * @brief 设置目标路径
47 * @param path
48 */
49 void setCurrentPath(const QString Dirpath);
50
51 /**
52 * @brief 获取目标路径
53 * @return QString
54 */
55 QString currentPath() const;
56
57 /**
58 * @brief 设置tabbar显示个数
59 * @param int
60 */
61 void setVisibleDepth(const int depth);
62
63 /**
64 * @brief 获取tabbar显示个数
65 * @return int
66 */
67 int visibleDepth();
68
69 /**
70 * @brief 设置图标
71 * @param icon
72 */
73 void setIcon(int index, const QIcon &icon);
74
75 /**
76 * @brief 获取图标
77 * @return QIcon
78 */
79 QIcon icon(int index);
80
81 /**
82 * @brief 设置Root
83 * @param
84 */
85 void setRootPath(const QString targetPath);
86
87 /**
88 * @brief 获取Root路径
89 * @return QString
90 */
91 QString RootPath();
92
93 /**
94 * @brief 设置按钮显示字体长度
95 * @param int
96 */
97 void setTextLength(int length);
98
99 /**
100 * @brief 返回字体显示长度
101 * @return int
102 */
103 int textLength();
104
105 /**
106 * @brief 返回button列表
107 * @return
108 */
109 QList<QToolButton *> buttons();
110 // QToolButton * buttonAt(int index);
111
112 signals:
113 void tabBarClicked(const QString uri);
114
115 protected:
116 // void paintEvent(QPaintEvent *event);//有图标和无图标,三态
117 // void mousePressEvent(QMouseEvent *e) override;
118
119 private:
120 Q_DECLARE_PRIVATE(KDirTabBar);
121 KDirTabBarPrivate *const d_ptr;
122 };
123
124 }
125 #endif // KDIRTABBAR_H