Set the current dive site uid / text

Start to make this thing usefull: Upon selecting the current index
or writting something on the line edit, we need to set the dive site.

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-09-22 16:36:17 -03:00 committed by Dirk Hohndel
parent 4352412731
commit 80b42bd28b

View file

@ -357,6 +357,9 @@ void DiveLocationModel::resetModel()
QVariant DiveLocationModel::data(const QModelIndex& index, int role) const
{
if(index.row() <= 1) { // two special cases.
if(index.column() == UUID) {
return RECENTLY_ADDED_DIVESITE;
}
switch(role) {
case Qt::DisplayRole : return new_ds_value[index.row()];
case Qt::ToolTipRole : return "Create a new dive site";
@ -475,14 +478,17 @@ bool DiveLocationLineEdit::eventFilter(QObject *o, QEvent *e)
void DiveLocationLineEdit::focusOutEvent(QFocusEvent* ev)
{
if (!view->isVisible()) {
qDebug() << "Focusing Out";
QLineEdit::focusOutEvent(ev);
}
}
void DiveLocationLineEdit::itemActivated(const QModelIndex& index)
{
qDebug() << "Activated" << index.data();
QModelIndex uuidIndex = index.model()->index(index.row(), DiveLocationModel::UUID);
uint32_t uuid = uuidIndex.data().toInt();
currType = uuid == 1 ? NEW_DIVE_SITE : EXISTING_DIVE_SITE;
currUuid = uuid;
setText(index.data().toString());
}
void DiveLocationLineEdit::refreshDiveSiteCache()