mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
4352412731
commit
80b42bd28b
1 changed files with 8 additions and 2 deletions
|
@ -357,6 +357,9 @@ void DiveLocationModel::resetModel()
|
||||||
QVariant DiveLocationModel::data(const QModelIndex& index, int role) const
|
QVariant DiveLocationModel::data(const QModelIndex& index, int role) const
|
||||||
{
|
{
|
||||||
if(index.row() <= 1) { // two special cases.
|
if(index.row() <= 1) { // two special cases.
|
||||||
|
if(index.column() == UUID) {
|
||||||
|
return RECENTLY_ADDED_DIVESITE;
|
||||||
|
}
|
||||||
switch(role) {
|
switch(role) {
|
||||||
case Qt::DisplayRole : return new_ds_value[index.row()];
|
case Qt::DisplayRole : return new_ds_value[index.row()];
|
||||||
case Qt::ToolTipRole : return "Create a new dive site";
|
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)
|
void DiveLocationLineEdit::focusOutEvent(QFocusEvent* ev)
|
||||||
{
|
{
|
||||||
if (!view->isVisible()) {
|
if (!view->isVisible()) {
|
||||||
qDebug() << "Focusing Out";
|
|
||||||
QLineEdit::focusOutEvent(ev);
|
QLineEdit::focusOutEvent(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveLocationLineEdit::itemActivated(const QModelIndex& index)
|
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()
|
void DiveLocationLineEdit::refreshDiveSiteCache()
|
||||||
|
|
Loading…
Add table
Reference in a new issue