Update font size in updateItemDislpay() instead of buildInternalStructure to prevent a bug where text overlapped (#3523)
This commit is contained in:
parent
5bed082b86
commit
dbda816d73
@ -399,13 +399,6 @@ void DynamicRibbonWidget::buildInternalStructure()
|
|||||||
ribbon->m_properties[PROP_ID] = name.str();
|
ribbon->m_properties[PROP_ID] = name.str();
|
||||||
ribbon->m_event_handler = this;
|
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
|
// add columns
|
||||||
for (int i=0; i<m_col_amount; i++)
|
for (int i=0; i<m_col_amount; i++)
|
||||||
{
|
{
|
||||||
@ -419,7 +412,6 @@ void DynamicRibbonWidget::buildInternalStructure()
|
|||||||
icon->m_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT];
|
icon->m_properties[PROP_HEIGHT] = m_properties[PROP_CHILD_HEIGHT];
|
||||||
icon->m_w = atoi(icon->m_properties[PROP_WIDTH].c_str());
|
icon->m_w = atoi(icon->m_properties[PROP_WIDTH].c_str());
|
||||||
icon->m_h = atoi(icon->m_properties[PROP_HEIGHT].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
|
// 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)
|
// 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";
|
//std::cout << "Row " << n << "\n{\n";
|
||||||
|
|
||||||
const unsigned int items_in_row = row.m_children.size();
|
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<items_in_row; i++)
|
for (unsigned int i=0; i<items_in_row; i++)
|
||||||
{
|
{
|
||||||
IconButtonWidget* icon = dynamic_cast<IconButtonWidget*>(&row.m_children[i]);
|
IconButtonWidget* icon = dynamic_cast<IconButtonWidget*>(&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->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->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->setLabel(m_items[icon_id].m_user_name);
|
||||||
icon->m_text = 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;
|
icon->m_badges = m_items[icon_id].m_badges;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user