From 785051c9dd0734acfdbb14fea558aa6e59917b68 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 26 May 2015 17:34:37 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index b433805e0..7c7e5e297 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -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) -- cgit v1.2.3-70-g09d2