QAbstractItemModel::match: code tidies

Remove a magic number from the code, by adding it (as a private value)
to the right enumeration. Use toInt() to convert to integer.

Change-Id: Id1b00dde900619684b5a3df247d46938439150ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2021-05-02 01:10:13 +02:00
parent cdd6a1f138
commit 9887f32df9
3 changed files with 3 additions and 1 deletions

View File

@ -1547,6 +1547,7 @@ namespace Qt {
MatchRegularExpression = 4,
MatchWildcard = 5,
MatchFixedString = 8,
MatchTypeMask = 0x0F,
MatchCaseSensitive = 16,
MatchWrap = 32,
MatchRecursive = 64

View File

@ -2838,6 +2838,7 @@
the search reaches the last item in the model, it begins again at
the first item and continues until all items have been examined.
\value MatchRecursive Searches the entire hierarchy.
\omitvalue MatchTypeMask
\sa QString::compare(), QRegularExpression
*/

View File

@ -2533,7 +2533,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
Qt::MatchFlags flags) const
{
QModelIndexList result;
uint matchType = flags & 0x0F;
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;