From dbda816d7312241cf0eebc691d301c58587884f3 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 19 Oct 2018 16:33:05 -0600 Subject: [PATCH] Update font size in updateItemDislpay() instead of buildInternalStructure to prevent a bug where text overlapped (#3523) --- src/guiengine/widgets/dynamic_ribbon_widget.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/guiengine/widgets/dynamic_ribbon_widget.cpp b/src/guiengine/widgets/dynamic_ribbon_widget.cpp index 25a78ea5c..482c10835 100644 --- a/src/guiengine/widgets/dynamic_ribbon_widget.cpp +++ b/src/guiengine/widgets/dynamic_ribbon_widget.cpp @@ -399,13 +399,6 @@ void DynamicRibbonWidget::buildInternalStructure() ribbon->m_properties[PROP_ID] = name.str(); ribbon->m_event_handler = this; - // calculate font size - if (m_col_amount > 0) - { - m_font->setScale(GUIEngine::getFont()->getScale() * - getFontScale((ribbon->m_w / m_col_amount) - 30)); - } - // add columns for (int i=0; im_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT]; icon->m_w = atoi(icon->m_properties[PROP_WIDTH].c_str()); icon->m_h = atoi(icon->m_properties[PROP_HEIGHT].c_str()); - icon->setLabelFont(m_font); // If we want each icon to have its own label, we must make it non-empty, otherwise // it will assume there is no label and none will be created (FIXME: that's ugly) @@ -977,6 +969,14 @@ void DynamicRibbonWidget::updateItemDisplay() //std::cout << "Row " << n << "\n{\n"; const unsigned int items_in_row = row.m_children.size(); + + // calculate font size + if (m_col_amount > 0) + { + m_font->setScale(GUIEngine::getFont()->getScale() * + getFontScale((row.m_w / m_col_amount) - 30)); + } + for (unsigned int i=0; i(&row.m_children[i]); @@ -994,6 +994,7 @@ void DynamicRibbonWidget::updateItemDisplay() icon->setImage( item_icon.c_str(), m_items[icon_id].m_image_path_type ); icon->m_properties[PROP_ID] = m_items[icon_id].m_code_name; + icon->setLabelFont(m_font); icon->setLabel(m_items[icon_id].m_user_name); icon->m_text = m_items[icon_id].m_user_name; icon->m_badges = m_items[icon_id].m_badges;