From 6da2d40d3c6f288695ece0384bbad229b345f2b8 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 13 Aug 2013 10:49:59 -0300 Subject: Added completion for buddy, divemaster, location and suit. Added completion for buddy, divemaster, location and suit. The completions uses some models that I created in the last commit - everytime that a divelog file is loaded, it creates a list of completion items. Signed-off-by: Tomaz Canabrava --- qt-ui/maintab.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index f2fed0921..44429f8c8 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -12,8 +12,10 @@ #include "divelistview.h" #include "modeldelegates.h" #include "globe.h" +#include "completionmodels.h" #include +#include #include #include #include @@ -94,6 +96,16 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui->weights->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate()); connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); + + completers.buddy = new QCompleter(BuddyCompletionModel::instance(), ui->buddy); + completers.divemaster = new QCompleter(DiveMasterCompletionModel::instance(), ui->divemaster); + completers.location = new QCompleter(LocationCompletionModel::instance(), ui->location); + completers.suit = new QCompleter(SuitCompletionModel::instance(), ui->suit); + ui->buddy->setCompleter(completers.buddy); + ui->divemaster->setCompleter(completers.divemaster); + ui->location->setCompleter(completers.location); + ui->suit->setCompleter(completers.suit); + initialUiSetup(); } @@ -348,6 +360,10 @@ void MainTab::addWeight_clicked() void MainTab::reload() { + SuitCompletionModel::instance()->updateModel(); + BuddyCompletionModel::instance()->updateModel(); + LocationCompletionModel::instance()->updateModel(); + DiveMasterCompletionModel::instance()->updateModel(); } void MainTab::on_editAccept_clicked(bool edit) -- cgit v1.2.3-70-g09d2