From 1b8f7f53f2a715b7e0faaf404985165b608b840a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 1 Jul 2015 19:31:35 -0300 Subject: Added again a QCompleter to show the possibilities Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 8 ++++++++ qt-ui/maintab.h | 1 + 2 files changed, 9 insertions(+) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 1236c949d..fe1143f39 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -58,6 +58,13 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.extraData->setModel(extraDataModel); closeMessage(); + QCompleter *completer = new QCompleter(); + completer->setModel(LocationInformationModel::instance()); + completer->setCompletionColumn(LocationInformationModel::NAME); + completer->setCompletionRole(Qt::DisplayRole); + completer->setCompletionMode(QCompleter::PopupCompletion); + + ui.location->setCompleter(completer); connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(showDiveSiteSimpleEdit())); QAction *action = new QAction(tr("Apply changes"), this); @@ -746,6 +753,7 @@ void MainTab::reload() buddyModel.updateModel(); diveMasterModel.updateModel(); tagModel.updateModel(); + LocationInformationModel::instance()->update(); } // tricky little macro to edit all the selected dives diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index a8f2dfab4..c96acb28a 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -14,6 +14,7 @@ #include "ui_maintab.h" #include "completionmodels.h" +#include "divelocationmodel.h" #include "dive.h" class WeightModel; -- cgit v1.2.3-70-g09d2