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
|
|
19 protected:
|
|
20 virtual void mouseMoveEvent(QMouseEvent* event) override;
|
|
21 QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index,
|
|
22 const QEvent* event) const override;
|
|
23 int RemoveSeparatorsFromIndex(int index);
|
|
24 };
|
|
25 #endif // __gui__sidebar_h
|