Allow custom separators in menu-add-action-callback.

This commit is contained in:
John Preston 2024-04-11 16:09:57 +04:00
parent 2385fb30b5
commit d2420c6bf8
2 changed files with 7 additions and 2 deletions

View file

@ -8,6 +8,10 @@
#include "ui/style/style_core.h"
namespace style {
struct MenuSeparator;
} // namespace style
namespace Ui {
class PopupMenu;
} // namespace Ui
@ -20,6 +24,7 @@ public:
QString text;
Fn<void()> handler;
const style::icon *icon;
const style::MenuSeparator *separatorSt = nullptr;
Fn<void(not_null<Ui::PopupMenu*>)> fillSubmenu;
int addTopShift = 0;
bool isSeparator = false;

View file

@ -27,8 +27,8 @@ MenuCallback CreateAddActionCallback(not_null<Ui::PopupMenu*> menu) {
action->setMenu(Ui::CreateChild<QMenu>(menu->menu().get()));
a.fillSubmenu(menu->ensureSubmenu(action, menu->st()));
return action;
} else if (a.isSeparator) {
return menu->addSeparator();
} else if (a.separatorSt || a.isSeparator) {
return menu->addSeparator(a.separatorSt);
} else if (a.isAttention) {
return menu->addAction(base::make_unique_q<Ui::Menu::Action>(
menu,