Item models: code tidies

Use QFlags::testAnyFlag instead of relying on implicit conversions.

Change-Id: I7ac8149535ad28e47fbf3e250042892bdf8c3a72
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
bb10
Giuseppe D'Angelo 2021-05-02 02:24:50 +02:00
parent 3b0c6bf486
commit 861647e8a5
2 changed files with 3 additions and 3 deletions

View File

@ -2535,8 +2535,8 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
QModelIndexList result;
uint matchType = (flags & Qt::MatchTypeMask).toInt();
Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
bool recurse = flags & Qt::MatchRecursive;
bool wrap = flags & Qt::MatchWrap;
bool recurse = flags.testAnyFlag(Qt::MatchRecursive);
bool wrap = flags.testAnyFlag(Qt::MatchWrap);
bool allHits = (hits == -1);
QString text; // only convert to a string if it is needed
#if QT_CONFIG(regularexpression)

View File

@ -1477,7 +1477,7 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const
if (selected) {
Qt::ItemFlags flags = d->model->flags(index);
return (flags & Qt::ItemIsSelectable);
return flags.testAnyFlag(Qt::ItemIsSelectable);
}
return false;