Mercurial > minori
annotate include/gui/widgets/sidebar.h @ 79:c489dd4434af
*: what did I do again?
I really forgot what I did here :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 12 Oct 2023 11:31:39 -0400 |
parents | 27a19dd6cba1 |
children | c69230dc2b5d |
rev | line source |
---|---|
46 | 1 #ifndef __gui__sidebar_h |
2 #define __gui__sidebar_h | |
69 | 3 |
46 | 4 #include <QItemSelectionModel> |
5 #include <QListWidget> | |
6 #include <QListWidgetItem> | |
69 | 7 |
46 | 8 class SideBar : public QListWidget { |
9 Q_OBJECT | |
10 | |
11 public: | |
12 SideBar(QWidget* parent = nullptr); | |
13 QListWidgetItem* AddItem(QString name, QIcon icon = QIcon()); | |
14 QListWidgetItem* AddSeparator(); | |
15 bool IndexIsSeparator(QModelIndex index) const; | |
16 static QIcon CreateIcon(const char* file); | |
69 | 17 void SetBackgroundColor(QColor color); |
46 | 18 |
19 signals: | |
20 void CurrentItemChanged(int index); | |
21 | |
58
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
22 public slots: |
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
23 void SetCurrentItem(int index); |
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
24 |
46 | 25 protected: |
26 virtual void mouseMoveEvent(QMouseEvent* event) override; | |
27 QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index, | |
28 const QEvent* event) const override; | |
29 int RemoveSeparatorsFromIndex(int index); | |
58
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
30 int AddSeparatorsToIndex(int index); |
46 | 31 }; |
69 | 32 |
46 | 33 #endif // __gui__sidebar_h |