diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/locationinformation.cpp | 13 | ||||
-rw-r--r-- | qt-ui/locationinformation.h | 3 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 9 | ||||
-rw-r--r-- | qt-ui/maintab.h | 2 |
4 files changed, 24 insertions, 3 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 2f4b8afda..77adc819b 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -488,6 +488,7 @@ void DiveLocationLineEdit::itemActivated(const QModelIndex& index) qDebug() << "Setting a Existing dive site"; if(view->isVisible()) view->hide(); + emit diveSiteSelected(currUuid); } void DiveLocationLineEdit::refreshDiveSiteCache() @@ -580,11 +581,21 @@ void DiveLocationLineEdit::showPopup() if (!view->isVisible()) { setTemporaryDiveSiteName(text()); proxy->invalidate(); - view->setCurrentIndex( view->model()->index(0,1)); + view->setCurrentIndex(view->model()->index(0,1)); view->show(); } } +DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const +{ + return currType; +} + +uint32_t DiveLocationLineEdit::currDiveSiteUuid() const +{ + return currUuid; +} + DiveLocationListView::DiveLocationListView(QWidget *parent) { diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index 5085f83a2..db0d286ac 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -100,6 +100,9 @@ public: DiveSiteType currDiveSiteType() const; uint32_t currDiveSiteUuid() const; +signals: + void diveSiteSelected(uint32_t uuid); + protected: void keyPressEvent(QKeyEvent *ev); void focusOutEvent(QFocusEvent *ev); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 51df81d87..a68adb5bf 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1509,7 +1509,7 @@ void MainTab::on_location_textChanged() markChangedWidget(ui.location); } -void MainTab::on_location_editingFinished() +void MainTab::on_location_diveSiteSelected() { if (editMode == IGNORE || acceptingEdit == true) return; @@ -1519,6 +1519,13 @@ void MainTab::on_location_editingFinished() markChangedWidget(ui.location); emit diveSiteChanged(0); return; + } else { + if (ui.location->currDiveSiteUuid() != displayed_dive.dive_site_uuid) { + markChangedWidget(ui.location); + } else { + QPalette p; + ui.location->setPalette(p); + } } if (currentTrip) { diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 26dd3853e..a071e6c88 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -69,7 +69,7 @@ slots: void updateDiveInfo(bool clear = false); void acceptChanges(); void rejectChanges(); - void on_location_editingFinished(); + void on_location_diveSiteSelected(); void on_location_textChanged(); void on_divemaster_textChanged(); void on_buddy_textChanged(); |