Fixed crash on add item via favorite button after application start.

Favorite buttons has short name labels.
closes #296
refs #293
This commit is contained in:
2017-04-04 21:57:36 +02:00
parent aa91acbe17
commit 4b3a2e1dd7
11 changed files with 40 additions and 18 deletions
+4 -4
View File
@@ -36,8 +36,6 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
registerBinding(ui->favBtnSize);
m_itemModel = new AutoTableModel<ShopItem>();
}
ShopSettingsForm::~ShopSettingsForm()
@@ -61,7 +59,7 @@ void ShopSettingsForm::drawButtons()
if (m_btnMap[btn->objectName()] != NULL)
{
btn->setText(m_btnMap[btn->objectName()]->name());
btn->setText(m_btnMap[btn->objectName()]->shortName());
}
if (entity()->favBtnSize() > 0)
@@ -81,10 +79,11 @@ void ShopSettingsForm::drawButtons()
FavoritItemPtr favItem = QSharedPointer<FavoritItem>(new FavoritItem);
favItem->setFavButtonName(btn->objectName());
favItem->setName(item->name());
favItem->setShortName(item->shortName());
favItem->setRefId(item->id());
favItem->setPluginId(item->pluginId());
m_btnMap[btn->objectName()] = favItem;
btn->setText(item->name());
btn->setText(item->shortName());
});
}
}
@@ -102,6 +101,7 @@ void ShopSettingsForm::loadEntity()
ui->tableItems->setModel(m_itemModel);
ui->tableItems->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
ui->tableItems->setColumnHidden(0, true);
ui->tableItems->setColumnHidden(2, true);
ui->tableItems->setColumnHidden(3, true);
Service<FavoritItem> srvFav;