diff options
author | flow <flowlnlnln@gmail.com> | 2022-11-19 11:55:40 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-11-19 18:41:30 -0300 |
commit | 2367903ac6c6f6778935ed1bbab88fd8342dffa0 (patch) | |
tree | adf14dc9a22e10e25792124883b2455eb825fcaa /launcher/ui/widgets/WideBar.h | |
parent | 347ae0a9ad8d5d933ef76dedab177995029e5f0d (diff) | |
download | PrismLauncher-2367903ac6c6f6778935ed1bbab88fd8342dffa0.tar.gz PrismLauncher-2367903ac6c6f6778935ed1bbab88fd8342dffa0.tar.bz2 PrismLauncher-2367903ac6c6f6778935ed1bbab88fd8342dffa0.zip |
refactor: clean up WideBar a bit
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/widgets/WideBar.h')
-rw-r--r-- | launcher/ui/widgets/WideBar.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/launcher/ui/widgets/WideBar.h b/launcher/ui/widgets/WideBar.h index 8ff62ef2..4a714c80 100644 --- a/launcher/ui/widgets/WideBar.h +++ b/launcher/ui/widgets/WideBar.h @@ -2,17 +2,16 @@ #include <QAction> #include <QMap> +#include <QMenu> #include <QToolBar> -class QMenu; - class WideBar : public QToolBar { Q_OBJECT public: explicit WideBar(const QString& title, QWidget* parent = nullptr); explicit WideBar(QWidget* parent = nullptr); - virtual ~WideBar(); + ~WideBar() override = default; void addAction(QAction* action); void addSeparator(); @@ -25,10 +24,14 @@ class WideBar : public QToolBar { QMenu* createContextMenu(QWidget* parent = nullptr, const QString& title = QString()); private: - struct BarEntry; + struct BarEntry { + enum class Type { None, Action, Separator, Spacer } type = Type::None; + QAction* bar_action = nullptr; + QAction* menu_action = nullptr; + }; - auto getMatching(QAction* act) -> QList<BarEntry*>::iterator; + auto getMatching(QAction* act) -> QList<BarEntry>::iterator; private: - QList<BarEntry*> m_entries; + QList<BarEntry> m_entries; }; |