m_UserModelProxy = new UserModelProxy(this);
m_UserModelProxy->setSourceModel(this);
m_UserModelProxy->setDynamicSortFilter(true);
m_UserModelProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
m_UserModelProxy->setFilterRole(UsersModel::IDRole);
m_UserModelProxy->setFilterRegExp(filter); //I want to filter out ametinc from the model but it filters everything else is there a way to QRegExp is not equal to ametinc ....
m_UserModelProxy = new UserModelProxy(this);
m_UserModelProxy->setSourceModel(this);
m_UserModelProxy->setDynamicSortFilter(true);
m_UserModelProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
m_UserModelProxy->setFilterRole(UsersModel::IDRole);
QRegExp filter("ametinc");
m_UserModelProxy->setFilterRegExp(filter); //I want to filter out ametinc from the model but it filters everything else is there a way to QRegExp is not equal to ametinc ....
To copy to clipboard, switch view to plain text mode
this may not be the correct way to achieve this however I figured if I could filter out the one item form the model I don’t want to display I figured I try proxyModel
I'm still having a little trouble filtering out the ametinc user, I can set a proxy filter to filter out everything else besides ametinc cause thats what the filter is set to, I'm not sure how to get it to remove or hide it form the model though here is some code I been thinking about
the RegExp its filtering what to display I want to filter what not to display if that makes sense
m_UserModelProxy = new UserModelProxy(this);
m_UserModelProxy->setSourceModel(this);
m_UserModelProxy->setDynamicSortFilter(true);
m_UserModelProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
m_UserModelProxy->setFilterRole(UsersModel::IDRole);
QRegularExpression filter("ametinc");
if(filter.hasMatch()){
removeUser(filter.index);
}
m_UserModelProxy->setFilterRegExp(filter);
//m_UserModelProxy->setFilterRegExp(QRegExp::operator !=(filter));
//m_UserModelProxy->invalidate();
m_UserModelProxy = new UserModelProxy(this);
m_UserModelProxy->setSourceModel(this);
m_UserModelProxy->setDynamicSortFilter(true);
m_UserModelProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
m_UserModelProxy->setFilterRole(UsersModel::IDRole);
QRegularExpression filter("ametinc");
if(filter.hasMatch()){
removeUser(filter.index);
}
m_UserModelProxy->setFilterRegExp(filter);
//m_UserModelProxy->setFilterRegExp(QRegExp::operator !=(filter));
//m_UserModelProxy->invalidate();
To copy to clipboard, switch view to plain text mode
Bookmarks