Fix menus over a single column wide

Fixes menus more than 1 column wide (such as the Placement menus for
the Toolbar/Slit/Tabs) which stopped working with commit 3e4570b.
This commit is contained in:
Juan Gonzalez Lopez 2016-04-23 22:54:03 +02:00 committed by Mathias Gumz
parent 7b8e4413f8
commit 5d90b7984c

View file

@ -430,9 +430,6 @@ void Menu::updateMenu() {
m_item_w = std::max(iw, m_item_w); m_item_w = std::max(iw, m_item_w);
} }
// the menu width should be as wide as the widest menu item
w = m_item_w;
// calculate needed columns // calculate needed columns
m_columns = 0; m_columns = 0;
m_rows_per_column = 0; m_rows_per_column = 0;
@ -444,6 +441,10 @@ void Menu::updateMenu() {
} }
m_columns = std::max(m_min_columns, m_columns); m_columns = std::max(m_min_columns, m_columns);
// the menu width should be as wide as the widest menu item
w = m_item_w * m_columns;
m_rows_per_column = m_items.size() / m_columns; m_rows_per_column = m_items.size() / m_columns;
if (m_items.size() % m_columns) if (m_items.size() % m_columns)
m_rows_per_column++; m_rows_per_column++;