I have such a classes hierarchy:
class Base {
...
virtual QWidget* getEditor();
...
}
class Derived {
...
QWidget* getEditor() Q_DECL_OVERRIDE;
...
}
Both classes are registered via Q_DECLARE_METATYPE()
I'm getting instance of Base class from QVariant. Is it possible to get a pointer from QVariant to be able to invoke getEditor()
from a Derived object?
I'm trying this atm but have no success:
if (index.data(Qt::EditRole).canConvert<Base>())
return index.data(Qt::EditRole).value<Base>().getEditor(parent);
This snipper invokes Base class method.