QSFPM: don't let setFilterRegExp(QString) overwrite CaseSensitivity
This is a regression from commit 346c15102b, which creates a new QRegExp
in setFilterRegExp, losing previously set case sensitivity property
(i.e. when the code does proxy->setFilterCaseSensitivity(Qt::CaseInsensitive)
before setFilterRegExp).
Interestingly that commit ensured that setFilterFixedString would still
preserve CaseSensitivity, but not setFilterRegExp(QString).
Change-Id: I3d37d001ce6e86dd90e7e07431440a42607172f9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
bb10
parent
5f9a0d64b3
commit
ddeec1b07e
|
|
@ -2731,6 +2731,7 @@ void QSortFilterProxyModel::setFilterRegExp(const QString &pattern)
|
|||
Q_D(QSortFilterProxyModel);
|
||||
d->filter_about_to_be_changed();
|
||||
QRegExp rx(pattern);
|
||||
rx.setCaseSensitivity(d->filter_data.caseSensitivity());
|
||||
d->filter_data.setRegExp(rx);
|
||||
d->filter_changed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public:
|
|||
tst_QSortFilterProxyModelRegExp();
|
||||
private slots:
|
||||
void tst_invalid();
|
||||
void tst_caseSensitivity();
|
||||
};
|
||||
|
||||
tst_QSortFilterProxyModelRegExp::tst_QSortFilterProxyModelRegExp() :
|
||||
|
|
@ -55,5 +56,14 @@ void tst_QSortFilterProxyModelRegExp::tst_invalid()
|
|||
QCOMPARE(model.filterRegExp(), QRegExp());
|
||||
}
|
||||
|
||||
void tst_QSortFilterProxyModelRegExp::tst_caseSensitivity()
|
||||
{
|
||||
const QLatin1String pattern("test");
|
||||
QSortFilterProxyModel model;
|
||||
model.setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
model.setFilterRegExp(pattern);
|
||||
QCOMPARE(model.filterCaseSensitivity(), Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QSortFilterProxyModelRegExp)
|
||||
#include "tst_qsortfilterproxymodel_regexp.moc"
|
||||
|
|
|
|||
Loading…
Reference in New Issue