Changeset View
Changeset View
Standalone View
Standalone View
addons/tabswitcher/tabswitchertreeview.h
Show All 15 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef KTEXTEDITOR_TABSWITCHER_TREEVIEW_H | 21 | #ifndef KTEXTEDITOR_TABSWITCHER_TREEVIEW_H | ||
22 | #define KTEXTEDITOR_TABSWITCHER_TREEVIEW_H | 22 | #define KTEXTEDITOR_TABSWITCHER_TREEVIEW_H | ||
23 | 23 | | |||
24 | #include <QListView> | 24 | #include <QTreeView> | ||
25 | 25 | | |||
26 | class TabSwitcherTreeView : public QListView | 26 | /** | ||
27 | * TODO: see screenshots https://phabricator.kde.org/D16054: | ||||
28 | * some paths are truncated on the right side. Why? | ||||
29 | */ | ||||
30 | class TabSwitcherTreeView : public QTreeView | ||||
27 | { | 31 | { | ||
28 | Q_OBJECT | 32 | Q_OBJECT | ||
29 | 33 | | |||
30 | public: | 34 | public: | ||
31 | /** | 35 | /** | ||
32 | * Default constructor. | 36 | * Default constructor | ||
33 | */ | 37 | */ | ||
34 | TabSwitcherTreeView(); | 38 | TabSwitcherTreeView(); | ||
35 | 39 | | |||
40 | int sizeHintWidth() const; | ||||
41 | | ||||
42 | /** | ||||
43 | * todo: see inside | ||||
44 | */ | ||||
45 | void resizeColumnsToContents(); | ||||
46 | | ||||
36 | Q_SIGNALS: | 47 | Q_SIGNALS: | ||
37 | /** | 48 | /** | ||
38 | * This signal is emitted whenever use activates an item through | 49 | * This signal is emitted whenever use activates an item through | ||
39 | * the list view. | 50 | * the list view. | ||
40 | * @note @p selectionIndex is a model index of the selectionModel() | 51 | * @note @p selectionIndex is a model index of the selectionModel() | ||
41 | * and not of the QListView's model itself. | 52 | * and not of the QListView's model itself. | ||
42 | */ | 53 | */ | ||
43 | void itemActivated(const QModelIndex & selectionIndex); | 54 | void itemActivated(const QModelIndex & selectionIndex); | ||
44 | 55 | | |||
45 | protected: | 56 | protected: | ||
46 | /** | 57 | /** | ||
47 | * Reimplemented for tracking the CTRL key modifier. | 58 | * Reimplemented for tracking the CTRL key modifier. | ||
48 | */ | 59 | */ | ||
49 | void keyReleaseEvent(QKeyEvent * event) override; | 60 | void keyReleaseEvent(QKeyEvent * event) override; | ||
50 | 61 | | |||
51 | /** | 62 | /** | ||
52 | * Reimplemented for tracking the ESCAPE key. | 63 | * Reimplemented for tracking the ESCAPE key. | ||
53 | */ | 64 | */ | ||
54 | void keyPressEvent(QKeyEvent * event) override; | 65 | void keyPressEvent(QKeyEvent * event) override; | ||
66 | | ||||
67 | /** | ||||
68 | * Reimplemented for adjusting the column widths (todo: does not work yet) | ||||
69 | */ | ||||
70 | void showEvent(QShowEvent *event) override; | ||||
55 | }; | 71 | }; | ||
56 | 72 | | |||
57 | #endif // KTEXTEDITOR_TABSWITCHER_TREEVIEW_H | 73 | #endif // KTEXTEDITOR_TABSWITCHER_TREEVIEW_H |