Mercurial > minori
annotate include/gui/widgets/sidebar.h @ 64:fe719c109dbc
*: update
1. add media tracking ability, and it displays info on the `now playing` page
2. the `now playing` page now actually shows something
3. renamed every page class to be more accurate to what it is
4. ...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 01 Oct 2023 23:15:43 -0400 |
parents | b7a1c0010ffd |
children | 27a19dd6cba1 |
rev | line source |
---|---|
46 | 1 #ifndef __gui__sidebar_h |
2 #define __gui__sidebar_h | |
3 #include <QItemSelectionModel> | |
4 #include <QListWidget> | |
5 #include <QListWidgetItem> | |
6 class SideBar : public QListWidget { | |
7 Q_OBJECT | |
8 | |
9 public: | |
10 SideBar(QWidget* parent = nullptr); | |
11 QListWidgetItem* AddItem(QString name, QIcon icon = QIcon()); | |
12 QListWidgetItem* AddSeparator(); | |
13 bool IndexIsSeparator(QModelIndex index) const; | |
14 static QIcon CreateIcon(const char* file); | |
15 | |
16 signals: | |
17 void CurrentItemChanged(int index); | |
18 | |
58
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
19 public slots: |
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
20 void SetCurrentItem(int index); |
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
21 |
46 | 22 protected: |
23 virtual void mouseMoveEvent(QMouseEvent* event) override; | |
24 QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index, | |
25 const QEvent* event) const override; | |
26 int RemoveSeparatorsFromIndex(int index); | |
58
b7a1c0010ffd
sidebar: link view menu and sidebar together
Paper <mrpapersonic@gmail.com>
parents:
46
diff
changeset
|
27 int AddSeparatorsToIndex(int index); |
46 | 28 }; |
29 #endif // __gui__sidebar_h |