Allow different style for child PopupMenu.
This commit is contained in:
parent
4ff70e7dff
commit
9b0f4df007
3 changed files with 7 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ MenuCallback CreateAddActionCallback(
|
|||
a.icon);
|
||||
// Dummy menu.
|
||||
action->setMenu(Ui::CreateChild<QMenu>(menu->menu().get()));
|
||||
a.fillSubmenu(menu->ensureSubmenu(action));
|
||||
a.fillSubmenu(menu->ensureSubmenu(action, menu->st()));
|
||||
return action;
|
||||
} else if (a.isSeparator) {
|
||||
return menu->addSeparator();
|
||||
|
|
|
|||
|
|
@ -259,7 +259,9 @@ void PopupMenu::init() {
|
|||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
}
|
||||
|
||||
not_null<PopupMenu*> PopupMenu::ensureSubmenu(not_null<QAction*> action) {
|
||||
not_null<PopupMenu*> PopupMenu::ensureSubmenu(
|
||||
not_null<QAction*> action,
|
||||
const style::PopupMenu &st) {
|
||||
const auto &list = actions();
|
||||
const auto i = ranges::find(list, action);
|
||||
Assert(i != end(list));
|
||||
|
|
@ -270,7 +272,7 @@ not_null<PopupMenu*> PopupMenu::ensureSubmenu(not_null<QAction*> action) {
|
|||
}
|
||||
const auto result = _submenus.emplace(
|
||||
action,
|
||||
base::make_unique_q<PopupMenu>(parentWidget(), st())
|
||||
base::make_unique_q<PopupMenu>(parentWidget(), st)
|
||||
).first->second.get();
|
||||
result->deleteOnHide(false);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ public:
|
|||
|
||||
[[nodiscard]] const std::vector<not_null<QAction*>> &actions() const;
|
||||
[[nodiscard]] not_null<PopupMenu*> ensureSubmenu(
|
||||
not_null<QAction*> action);
|
||||
not_null<QAction*> action,
|
||||
const style::PopupMenu &st);
|
||||
void removeSubmenu(not_null<QAction*> action);
|
||||
void checkSubmenuShow();
|
||||
bool empty() const;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue