Mercurial > minori
diff src/include/sidebar.h @ 7:07a9095eaeed
Update
Refactored some code, moved some around
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 24 Aug 2023 23:11:38 -0400 |
parents | 1d82f6e04d7d |
children |
line wrap: on
line diff
--- a/src/include/sidebar.h Wed Aug 16 00:49:17 2023 -0400 +++ b/src/include/sidebar.h Thu Aug 24 23:11:38 2023 -0400 @@ -1,10 +1,23 @@ #ifndef __sidebar_h #define __sidebar_h #include <QListWidget> +#include <QListWidgetItem> +#include <QItemSelectionModel> class SideBar : public QListWidget { + Q_OBJECT + public: SideBar(QWidget *parent = nullptr); QListWidgetItem* AddItem(QString name, QIcon icon = QIcon()); QListWidgetItem* AddSeparator(); + bool IndexIsSeparator(QModelIndex index) const; + + signals: + void CurrentItemChanged(int index); + + protected: + virtual void mouseMoveEvent(QMouseEvent* event) override; + QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex & index, const QEvent * event) const override; + int RemoveSeparatorsFromIndex(int index); }; #endif // __sidebar_h