refactor: clean up WideBar a bit
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user