The user's entered value can be both: a string or an integer.
QAbstractTableModel's setData() method always gets this value as QtCore.QVariant
Question:
How to implement if/elif/else inside of setData() to distinguish if the received QVariant is a string or an integer? (so a proper QVariant conversion method (such as .toString() or toInt()) is used)
P.s. Interesting that an attempt to convert QVariant toInt() results to a tuple such as: (0, False) or (123, True)
You can check against the type:
Given that the form above is now obsolete, it is recommended to check it this way: