You can write the following utility functions:
bool IsCheckBox(const QWidget *widget) { return dynamic_cast<const QCheckBox*>(widget) != 0; } bool IsComboBox(const QWidget *widget) { return dynamic_cast<const QComboBox*>(widget) != 0; }
Or maybe you can use typeid to determine the runtime type of an object in a cell.
EDIT:
As @Evan noted in a comment, you can also use qobject_cast to cast the object instead of dynamic_cast . See examples here .
Nawaz
source share