The only way I see to write this "genericly" would be to have some virtual QVariant getValue() const and virtual QVariant setValue(QVariant v) in your base class and implement it in Derived.
This way you wouldn't have to do any casting, simply b2->setValue(b1->getValue()).
The implementation in Derived would do the cast to T via QVariant's value().
-
Unsolved typeid in a tempate derived class
C++ Gurus • • addebito -
Solved typeid meets heritage
General and Desktop • • Walux