Correctly display the data on the delegate

A bit more complex than I tought it would be (and a ton of trial
and error to find the right spot on the delegate to draw stuff)
this delegate follows the current style (so it should be okaish
on a dark and on a light theme)

This is supposed to work on a QCompleter, but it doesn't (I really don't
know why, so maybe I'll remove that completer. sigh.)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-07-01 21:04:03 -03:00 committed by Dirk Hohndel
parent 3b0936eca3
commit 4059f5d995
2 changed files with 66 additions and 7 deletions

View file

@ -63,6 +63,17 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
completer->setCompletionColumn(LocationInformationModel::NAME);
completer->setCompletionRole(Qt::DisplayRole);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setCaseSensitivity(Qt::CaseInsensitive);
QListView *completerListview = new QListView();
completerListview->setItemDelegate(new LocationFilterDelegate());
completer->setPopup(completerListview);
QListView *completerListView2 = new QListView();
completerListView2->setItemDelegate(new LocationFilterDelegate());
completerListView2->setModel(LocationInformationModel::instance());
completerListView2->setModelColumn(1);
completerListView2->show();
ui.location->setCompleter(completer);
connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(showDiveSiteSimpleEdit()));
@ -107,9 +118,6 @@ 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->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));