Only repopulate model when needed.

The old way we set the location and *then* updated the model, so the very
first location that we tried to show was empty.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-05-26 17:34:37 -03:00 committed by Dirk Hohndel
parent b7ec57bdef
commit 785051c9dd

View file

@ -82,6 +82,11 @@ void LocationInformationWidget::setCurrentDiveSite(int dive_nr)
void LocationInformationWidget::setLocationId(uint32_t uuid)
{
LocationInformationModel *m = (LocationInformationModel*) ui.currentLocation->model();
if (m->rowCount() == 0) {
m->update();
}
currentDs = get_dive_site_by_uuid(uuid);
if(!currentDs)
return;
@ -164,11 +169,8 @@ void LocationInformationWidget::rejectChanges()
void LocationInformationWidget::showEvent(QShowEvent *ev)
{
LocationInformationModel *m = (LocationInformationModel*) ui.currentLocation->model();
ui.diveSiteMessage->setCloseButtonVisible(false);
m->update();
QGroupBox::showEvent(ev);
}
void LocationInformationWidget::markChangedWidget(QWidget *w)