aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorleo78913 <leo3758@riseup.net>2022-12-30 21:06:14 -0300
committerleo78913 <leo3758@riseup.net>2023-01-20 19:44:39 -0300
commit3da1d6a464b1f9ce9d058f37b9b7c8841a0f0c85 (patch)
treef50528f07cb02f9f58bed5f5c05e16292827732c /launcher
parentb9df10c8bd520b4177d3e0cbbc7efe6cbe1da22c (diff)
downloadPrismLauncher-3da1d6a464b1f9ce9d058f37b9b7c8841a0f0c85.tar.gz
PrismLauncher-3da1d6a464b1f9ce9d058f37b9b7c8841a0f0c85.tar.bz2
PrismLauncher-3da1d6a464b1f9ce9d058f37b9b7c8841a0f0c85.zip
feat: add Widebar::InsertWidgetBefore method
Signed-off-by: leo78913 <leo3758@riseup.net>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/ui/widgets/WideBar.cpp10
-rw-r--r--launcher/ui/widgets/WideBar.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/launcher/ui/widgets/WideBar.cpp b/launcher/ui/widgets/WideBar.cpp
index 428be563..cee2038f 100644
--- a/launcher/ui/widgets/WideBar.cpp
+++ b/launcher/ui/widgets/WideBar.cpp
@@ -111,6 +111,16 @@ void WideBar::insertActionAfter(QAction* after, QAction* action)
m_menu_state = MenuState::Dirty;
}
+void WideBar::insertWidgetBefore(QAction* before, QWidget* widget)
+{
+ auto iter = getMatching(before);
+ if (iter == m_entries.end())
+ return;
+
+ BarEntry entry;
+ entry.bar_action = insertWidget(iter->bar_action, widget);
+}
+
void WideBar::insertSpacer(QAction* action)
{
auto iter = getMatching(action);
diff --git a/launcher/ui/widgets/WideBar.h b/launcher/ui/widgets/WideBar.h
index a0a7896c..4004d415 100644
--- a/launcher/ui/widgets/WideBar.h
+++ b/launcher/ui/widgets/WideBar.h
@@ -22,6 +22,7 @@ class WideBar : public QToolBar {
void insertSeparator(QAction* before);
void insertActionBefore(QAction* before, QAction* action);
void insertActionAfter(QAction* after, QAction* action);
+ void insertWidgetBefore(QAction* before, QWidget* widget);
QMenu* createContextMenu(QWidget* parent = nullptr, const QString& title = QString());
void showVisibilityMenu(const QPoint&);