Allow custom separators in menu-add-action-callback.
This commit is contained in:
parent
2385fb30b5
commit
d2420c6bf8
2 changed files with 7 additions and 2 deletions
|
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
#include "ui/style/style_core.h"
|
#include "ui/style/style_core.h"
|
||||||
|
|
||||||
|
namespace style {
|
||||||
|
struct MenuSeparator;
|
||||||
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PopupMenu;
|
class PopupMenu;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
@ -20,6 +24,7 @@ public:
|
||||||
QString text;
|
QString text;
|
||||||
Fn<void()> handler;
|
Fn<void()> handler;
|
||||||
const style::icon *icon;
|
const style::icon *icon;
|
||||||
|
const style::MenuSeparator *separatorSt = nullptr;
|
||||||
Fn<void(not_null<Ui::PopupMenu*>)> fillSubmenu;
|
Fn<void(not_null<Ui::PopupMenu*>)> fillSubmenu;
|
||||||
int addTopShift = 0;
|
int addTopShift = 0;
|
||||||
bool isSeparator = false;
|
bool isSeparator = false;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ MenuCallback CreateAddActionCallback(not_null<Ui::PopupMenu*> menu) {
|
||||||
action->setMenu(Ui::CreateChild<QMenu>(menu->menu().get()));
|
action->setMenu(Ui::CreateChild<QMenu>(menu->menu().get()));
|
||||||
a.fillSubmenu(menu->ensureSubmenu(action, menu->st()));
|
a.fillSubmenu(menu->ensureSubmenu(action, menu->st()));
|
||||||
return action;
|
return action;
|
||||||
} else if (a.isSeparator) {
|
} else if (a.separatorSt || a.isSeparator) {
|
||||||
return menu->addSeparator();
|
return menu->addSeparator(a.separatorSt);
|
||||||
} else if (a.isAttention) {
|
} else if (a.isAttention) {
|
||||||
return menu->addAction(base::make_unique_q<Ui::Menu::Action>(
|
return menu->addAction(base::make_unique_q<Ui::Menu::Action>(
|
||||||
menu,
|
menu,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue