diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-10 16:25:15 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-10 16:25:15 +0300 |
commit | 35ccfdb7996ba727039ad2c0ab2974a49eecb6cc (patch) | |
tree | 2ef737788a9a0d5c6e810373371c2497f6e1c59c /launcher/ui/widgets/WideBar.cpp | |
parent | 6d758795af8a414d13db4951e3e9ed60af7091fd (diff) | |
parent | 91c9082d19b957c3295e7a0b5bc6add71e6459b8 (diff) | |
download | PrismLauncher-35ccfdb7996ba727039ad2c0ab2974a49eecb6cc.tar.gz PrismLauncher-35ccfdb7996ba727039ad2c0ab2974a49eecb6cc.tar.bz2 PrismLauncher-35ccfdb7996ba727039ad2c0ab2974a49eecb6cc.zip |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into catpacks
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/ui/widgets/WideBar.cpp')
-rw-r--r-- | launcher/ui/widgets/WideBar.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/launcher/ui/widgets/WideBar.cpp b/launcher/ui/widgets/WideBar.cpp index ac34e3aa..a77c45fe 100644 --- a/launcher/ui/widgets/WideBar.cpp +++ b/launcher/ui/widgets/WideBar.cpp @@ -116,12 +116,21 @@ void WideBar::insertActionAfter(QAction* after, QAction* action) if (iter == m_entries.end()) return; + iter++; + // the action to insert after is present + // however, the element after it isn't valid + if (iter == m_entries.end()) { + // append the action instead of inserting it + addAction(action); + return; + } + BarEntry entry; - entry.bar_action = insertWidget((iter + 1)->bar_action, new ActionButton(action, this, m_use_default_action)); + entry.bar_action = insertWidget(iter->bar_action, new ActionButton(action, this, m_use_default_action)); entry.menu_action = action; entry.type = BarEntry::Type::Action; - m_entries.insert(iter + 1, entry); + m_entries.insert(iter, entry); m_menu_state = MenuState::Dirty; } |