Ref T75, utility function

This commit is contained in:
Klaus Basan
2017-05-07 22:06:23 +02:00
parent a9938fd7fe
commit 614efd7681
2 changed files with 12 additions and 2 deletions

View File

@@ -39,6 +39,15 @@ namespace BlackGui
}
}
int CFilterWidget::convertDbId(const QString &candidate)
{
const QString s = candidate.trimmed();
if (s.isEmpty()) { return -1; }
bool ok = false;
const int id = s.toInt(&ok);
return ok && id >= 0 ? id : -1;
}
void CFilterWidget::triggerFilter()
{
this->ps_filterButtonClicked(CFilterBarButtons::Filter);
@@ -67,6 +76,5 @@ namespace BlackGui
break;
}
}
} // namespace
} // namespace

View File

@@ -57,6 +57,9 @@ namespace BlackGui
//! Clear the filter form
virtual void clearForm() = 0;
//! Convert DB id
static int convertDbId(const QString &candidate);
private slots:
//! Button clicked
void ps_filterButtonClicked(CFilterBarButtons::FilterButton filterButton);
@@ -64,7 +67,6 @@ namespace BlackGui
//! Stylesheet changed
void ps_onStyleSheetChanged();
};
} // namespace
} // namespace