Check if filter and model needs to be updated in setters
This commit is contained in:
parent
bfcc27e01d
commit
ea427e54c2
@ -67,6 +67,10 @@ int SortFilterModel::roleNameToId(const QString &name)
|
|||||||
|
|
||||||
void SortFilterModel::setModel(QObject *source)
|
void SortFilterModel::setModel(QObject *source)
|
||||||
{
|
{
|
||||||
|
if (source == sourceModel()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QAbstractItemModel *model = 0;
|
QAbstractItemModel *model = 0;
|
||||||
if (source) {
|
if (source) {
|
||||||
model = qobject_cast<QAbstractItemModel *>(source);
|
model = qobject_cast<QAbstractItemModel *>(source);
|
||||||
@ -91,6 +95,9 @@ void SortFilterModel::setModel(QObject *source)
|
|||||||
|
|
||||||
void SortFilterModel::setFilterRegExp(const QString &exp)
|
void SortFilterModel::setFilterRegExp(const QString &exp)
|
||||||
{
|
{
|
||||||
|
if (exp == filterRegExp()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
QSortFilterProxyModel::setFilterRegExp(QRegExp(exp, Qt::CaseInsensitive));
|
QSortFilterProxyModel::setFilterRegExp(QRegExp(exp, Qt::CaseInsensitive));
|
||||||
filterRegExpChanged(exp);
|
filterRegExpChanged(exp);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user