aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/locationinformation.cpp6
-rw-r--r--qt-ui/locationinformation.h2
-rw-r--r--qt-ui/maintab.cpp3
3 files changed, 10 insertions, 1 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 47ceb654e..39a8341cd 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -255,6 +255,12 @@ void LocationManagementEditHelper::handleActivation(const QModelIndex& activated
QModelIndex uuidIdx = activated.model()->index(
activated.row(), LocationInformationModel::UUID);
last_uuid = uuidIdx.data().toInt();
+
+ // Special case: first option, add dive site.
+ if (activated.row() == 0) {
+ qDebug() << "Setting to " << activated.data().toString();
+ emit setLineEditText(activated.data().toString());
+ }
qDebug() << "Selected dive_site: " << last_uuid;
}
diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h
index b37731969..b55a1b42c 100644
--- a/qt-ui/locationinformation.h
+++ b/qt-ui/locationinformation.h
@@ -51,6 +51,8 @@ public:
void handleActivation(const QModelIndex& activated);
void resetDiveSiteUuid();
uint32_t diveSiteUuid() const;
+signals:
+ void setLineEditText(const QString& text);
private:
uint32_t last_uuid;
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 05196254a..53d8e30b6 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -62,7 +62,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
QCompleter *completer = new QCompleter();
QListView *completerListview = new QListView();
LocationInformationModel::instance()->setFirstRowTextField(ui.location);
-
completer->setPopup(completerListview);
completer->setModel(LocationInformationModel::instance());
completer->setCompletionColumn(LocationInformationModel::NAME);
@@ -70,6 +69,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
completerListview->setItemDelegate(new LocationFilterDelegate());
locationManagementEditHelper = new LocationManagementEditHelper();
+ connect(locationManagementEditHelper, &LocationManagementEditHelper::setLineEditText,
+ ui.location, &QLineEdit::setText);
completerListview->installEventFilter(locationManagementEditHelper);
connect(completerListview, &QAbstractItemView::activated,
locationManagementEditHelper, &LocationManagementEditHelper::handleActivation);