mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
QVariant comparison optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a6ada9560f
commit
404305980c
1 changed files with 6 additions and 6 deletions
|
@ -2973,18 +2973,18 @@ static inline bool qIsFloatingPoint(int tp)
|
|||
*/
|
||||
bool QVariant::cmp(const QVariant &v) const
|
||||
{
|
||||
QVariant v2 = v;
|
||||
if (d.type != v2.d.type) {
|
||||
if (d.type != v.d.type) {
|
||||
if (qIsNumericType(d.type) && qIsNumericType(v.d.type)) {
|
||||
if (qIsFloatingPoint(d.type) || qIsFloatingPoint(v.d.type))
|
||||
return qFuzzyCompare(toReal(), v.toReal());
|
||||
else
|
||||
return toLongLong() == v.toLongLong();
|
||||
return toLongLong() == v.toLongLong();
|
||||
}
|
||||
if (!v2.canConvert(Type(d.type)) || !v2.convert(Type(d.type)))
|
||||
QVariant v2(v);
|
||||
if (!v2.convert(Type(d.type)))
|
||||
return false;
|
||||
return handler->compare(&d, &v2.d);
|
||||
}
|
||||
return handler->compare(&d, &v2.d);
|
||||
return handler->compare(&d, &v.d);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
|
Loading…
Add table
Reference in a new issue