comparison include/gui/widgets/sidebar.h @ 69:27a19dd6cba1

*: fix up some stuff settings: due to my own incompetence OnOK caused the entire program to crash, now that's fixed :)
author Paper <mrpapersonic@gmail.com>
date Tue, 03 Oct 2023 03:38:25 -0400
parents b7a1c0010ffd
children c69230dc2b5d
comparison
equal deleted inserted replaced
68:2417121d894e 69:27a19dd6cba1
1 #ifndef __gui__sidebar_h 1 #ifndef __gui__sidebar_h
2 #define __gui__sidebar_h 2 #define __gui__sidebar_h
3
3 #include <QItemSelectionModel> 4 #include <QItemSelectionModel>
4 #include <QListWidget> 5 #include <QListWidget>
5 #include <QListWidgetItem> 6 #include <QListWidgetItem>
7
6 class SideBar : public QListWidget { 8 class SideBar : public QListWidget {
7 Q_OBJECT 9 Q_OBJECT
8 10
9 public: 11 public:
10 SideBar(QWidget* parent = nullptr); 12 SideBar(QWidget* parent = nullptr);
11 QListWidgetItem* AddItem(QString name, QIcon icon = QIcon()); 13 QListWidgetItem* AddItem(QString name, QIcon icon = QIcon());
12 QListWidgetItem* AddSeparator(); 14 QListWidgetItem* AddSeparator();
13 bool IndexIsSeparator(QModelIndex index) const; 15 bool IndexIsSeparator(QModelIndex index) const;
14 static QIcon CreateIcon(const char* file); 16 static QIcon CreateIcon(const char* file);
17 void SetBackgroundColor(QColor color);
15 18
16 signals: 19 signals:
17 void CurrentItemChanged(int index); 20 void CurrentItemChanged(int index);
18 21
19 public slots: 22 public slots:
24 QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index, 27 QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index,
25 const QEvent* event) const override; 28 const QEvent* event) const override;
26 int RemoveSeparatorsFromIndex(int index); 29 int RemoveSeparatorsFromIndex(int index);
27 int AddSeparatorsToIndex(int index); 30 int AddSeparatorsToIndex(int index);
28 }; 31 };
32
29 #endif // __gui__sidebar_h 33 #endif // __gui__sidebar_h