Qt Code:
  1. Qt::CheckState checked = (Qt::CheckState) variant.convert(QVariant::Int);
To copy to clipboard, switch view to plain text mode 
Don't know whether this is your problem or not, but variant.convert() returns a bool. In this case it will always be true (checked in the preceding "if" statement). Try using variant.toInt()