mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-04 04:29:58 +01:00
Improve element query widget
User can now filter each field of the query
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user