Improve element query widget

User can now filter each field of the query
This commit is contained in:
Claveau Joshua
2020-04-05 21:48:08 +02:00
parent 035709b70f
commit 60e61a9f20
8 changed files with 248 additions and 55 deletions

View File

@@ -165,12 +165,7 @@ QVariant NomenclatureModel::data(const QModelIndex &index, int role) const
void NomenclatureModel::query(const QString &query)
{
auto rm_ = m_query != query;
if (rm_)
{
auto headers = projectDataBase::headersFromElementsInfoQuery(query);
for (auto i=0 ; i<headers.size() ; ++i) {
this->setHeaderData(i, Qt::Horizontal, headers.at(i));
}
if (rm_) {
emit beginResetModel();
}
@@ -195,6 +190,18 @@ QETProject *NomenclatureModel::project() const {
return m_project.data();
}
/**
* @brief NomenclatureModel::autoHeaders
* Try to determine the name of each columns header
*/
void NomenclatureModel::autoHeaders()
{
auto headers = projectDataBase::headersFromElementsInfoQuery(m_query);
for (auto i=0 ; i<headers.size() ; ++i) {
this->setHeaderData(i, Qt::Horizontal, headers.at(i));
}
}
/**
* @brief NomenclatureModel::dataBaseUpdated
* slot called when the project database is updated