Improve performance of QVariant::canConvert()
Add an early check if both types are the same. Change-Id: If6fc60a58fce641521c083bf920e72bf3d2d4c28 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
9ad0e09f5b
commit
1d5e55c2a3
@ -3052,6 +3052,9 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject)
|
||||
*/
|
||||
bool QVariant::canConvert(int targetTypeId) const
|
||||
{
|
||||
if (d.type == targetTypeId)
|
||||
return true;
|
||||
|
||||
if ((targetTypeId == QMetaType::QModelIndex && d.type == QMetaType::QPersistentModelIndex)
|
||||
|| (targetTypeId == QMetaType::QPersistentModelIndex && d.type == QMetaType::QModelIndex))
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user