Fixed adjustment of menu items by largest width.

This commit is contained in:
23rd 2021-01-29 21:28:15 +03:00
parent f03209c1f9
commit d94cb34219

View file

@ -122,15 +122,17 @@ not_null<QAction*> Menu::addAction(base::unique_qptr<ItemBase> widget) {
}, widget->lifetime()); }, widget->lifetime());
widget->minWidthValue( widget->minWidthValue(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=](int minWidth) {
const auto newWidth = _forceWidth const auto newWidth = _forceWidth
? _forceWidth ? _forceWidth
: _actionWidgets.empty() : _actionWidgets.empty()
? _st.widthMin ? _st.widthMin
: (*ranges::max_element( : std::max(
_actionWidgets, minWidth,
std::less<>(), (*ranges::max_element(
&ItemBase::minWidth))->minWidth(); _actionWidgets,
std::less<>(),
&ItemBase::minWidth))->minWidth());
resizeFromInner(newWidth, height()); resizeFromInner(newWidth, height());
}, widget->lifetime()); }, widget->lifetime());