diff options
author | timoreo <timo.oreo34@gmail.com> | 2022-01-28 19:32:42 +0100 |
---|---|---|
committer | timoreo <timo.oreo34@gmail.com> | 2022-01-28 19:32:42 +0100 |
commit | efc44c56a62def0242353dde9c84452690209465 (patch) | |
tree | 515eefa1f21f83ff92070a42c6399269aa9ffddd /launcher/ui/widgets | |
parent | 8b790a6dd94a7b779b72595f1e1567eda9877e86 (diff) | |
download | PrismLauncher-efc44c56a62def0242353dde9c84452690209465.tar.gz PrismLauncher-efc44c56a62def0242353dde9c84452690209465.tar.bz2 PrismLauncher-efc44c56a62def0242353dde9c84452690209465.zip |
Fix button being present in other pages
Diffstat (limited to 'launcher/ui/widgets')
-rw-r--r-- | launcher/ui/widgets/WideBar.cpp | 14 | ||||
-rw-r--r-- | launcher/ui/widgets/WideBar.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/launcher/ui/widgets/WideBar.cpp b/launcher/ui/widgets/WideBar.cpp index cbd6c617..8d5bd12d 100644 --- a/launcher/ui/widgets/WideBar.cpp +++ b/launcher/ui/widgets/WideBar.cpp @@ -76,6 +76,20 @@ void WideBar::addSeparator() m_entries.push_back(entry); } +void WideBar::insertActionBefore(QAction* before, QAction* action){ + auto iter = std::find_if(m_entries.begin(), m_entries.end(), [before](BarEntry * entry) { + return entry->wideAction == before; + }); + if(iter == m_entries.end()) { + return; + } + auto entry = new BarEntry(); + entry->qAction = insertWidget((*iter)->qAction, new ActionButton(action, this)); + entry->wideAction = action; + entry->type = BarEntry::Action; + m_entries.insert(iter, entry); +} + void WideBar::insertSpacer(QAction* action) { auto iter = std::find_if(m_entries.begin(), m_entries.end(), [action](BarEntry * entry) { diff --git a/launcher/ui/widgets/WideBar.h b/launcher/ui/widgets/WideBar.h index d1b8cbe7..2b676a8c 100644 --- a/launcher/ui/widgets/WideBar.h +++ b/launcher/ui/widgets/WideBar.h @@ -18,6 +18,7 @@ public: void addAction(QAction *action); void addSeparator(); void insertSpacer(QAction *action); + void insertActionBefore(QAction *before, QAction *action); QMenu *createContextMenu(QWidget *parent = nullptr, const QString & title = QString()); private: |