summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-06-25 15:27:14 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-26 18:49:59 -0700
commite28af7c639d9c985b9be5dba2ede497e7a7e4cda (patch)
tree559986831e5a45975ae5d42669d9fc5f92cae1b0
parent8bd9fb161a8607683d94b7179f46888cb44be9f4 (diff)
downloadsubsurface-e28af7c639d9c985b9be5dba2ede497e7a7e4cda.tar.gz
Dive site rewrite: use a QCompleter to show the list of dive sites
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp9
1 files changed, 8 insertions, 1 deletions
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<LocationCompletionModel*>(ui.location->completer()->model());
+ m->updateModel();
+
process_selected_dives();
process_all_dives(&displayed_dive, &prevd);