Qvariant to Int

if myVariant.canConvert(QMetaType.Int):
    value = myVariant.toInt()
elif myVariant.canConvert(QMetaType.QString)
    value = myVariant.toString()
Disturbed Dunlin