aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/widgets/WideBar.h
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-11-19 13:39:43 -0300
committerflow <flowlnlnln@gmail.com>2022-11-19 18:41:30 -0300
commit6e1639551bbe98b32e9abef2d816e8abe01789e4 (patch)
tree85c22fa4df754a866f10de21d4f16c90dd060b28 /launcher/ui/widgets/WideBar.h
parent2367903ac6c6f6778935ed1bbab88fd8342dffa0 (diff)
downloadPrismLauncher-6e1639551bbe98b32e9abef2d816e8abe01789e4.tar.gz
PrismLauncher-6e1639551bbe98b32e9abef2d816e8abe01789e4.tar.bz2
PrismLauncher-6e1639551bbe98b32e9abef2d816e8abe01789e4.zip
feat(WideBar): allow hiding buttons with right-click
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/widgets/WideBar.h')
-rw-r--r--launcher/ui/widgets/WideBar.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/launcher/ui/widgets/WideBar.h b/launcher/ui/widgets/WideBar.h
index 4a714c80..8421eaf4 100644
--- a/launcher/ui/widgets/WideBar.h
+++ b/launcher/ui/widgets/WideBar.h
@@ -5,6 +5,8 @@
#include <QMenu>
#include <QToolBar>
+#include <memory>
+
class WideBar : public QToolBar {
Q_OBJECT
@@ -22,6 +24,7 @@ class WideBar : public QToolBar {
void insertActionAfter(QAction* after, QAction* action);
QMenu* createContextMenu(QWidget* parent = nullptr, const QString& title = QString());
+ void contextMenuEvent(QContextMenuEvent*) override;
private:
struct BarEntry {
@@ -34,4 +37,8 @@ class WideBar : public QToolBar {
private:
QList<BarEntry> m_entries;
+
+ // Menu to toggle visibility from buttons in the bar
+ std::unique_ptr<QMenu> m_bar_menu = nullptr;
+ enum class MenuState { Fresh, Dirty } m_menu_state = MenuState::Dirty;
};