aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-05-26 17:34:37 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-26 21:47:55 -0700
commit785051c9dd0734acfdbb14fea558aa6e59917b68 (patch)
tree5e292af4c4a703570bdb4e64840b0cf91b50ee7c
parentb7ec57bdeff11d4639397efffd693eeafe6a0f55 (diff)
downloadsubsurface-785051c9dd0734acfdbb14fea558aa6e59917b68.tar.gz
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>
-rw-r--r--qt-ui/locationinformation.cpp8
1 files changed, 5 insertions, 3 deletions
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)