From e28af7c639d9c985b9be5dba2ede497e7a7e4cda Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 25 Jun 2015 15:27:14 -0300 Subject: Dive site rewrite: use a QCompleter to show the list of dive sites Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index adc60aec0..99459dbd3 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -99,7 +99,11 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex))); connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeightWidget(QModelIndex))); - ui.location->setCompleter(new QCompleter(LocationInformationModel::instance())); + LocationCompletionModel *locationCompletion = new LocationCompletionModel(); + ui.location->setCompleter(new QCompleter(locationCompletion)); + ui.location->completer()->setCaseSensitivity(Qt::CaseInsensitive); + ui.location->completer()->setCompletionMode(QCompleter::PopupCompletion); + ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this)); ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::USE, new TankUseDelegate(this)); ui.weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate(this)); @@ -455,6 +459,9 @@ void MainTab::updateDiveInfo(bool clear) struct dive *prevd; char buf[1024]; + LocationCompletionModel *m = qobject_cast(ui.location->completer()->model()); + m->updateModel(); + process_selected_dives(); process_all_dives(&displayed_dive, &prevd); -- cgit v1.2.3-70-g09d2