Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
4.6.3, 4.7.4, 4.8.3
-
None
-
all
-
caaeb2043541865ef7a9da424238d54b6556f8aa
Description
Currently, QVariantAnimation has one pure virtual method: updateCurrentValue(). That makes it impossible to use the class directly, even though the rest of the functionality suggests that that would be perfectly possible and useful even with an empty implementation of this method.
I have a use case where I would like to use QVariantAnimation to animate an internal value in my class. I do not want to provide a property for it, as that would break encapsulation. QVariantAnimation provides a valueChanged() signal, which is perfectly suitable to animate my value through a private slot. Why then do I need to supply some arbitrairy implementation of updateCurrentValue? A virtual method is useful for subclassing, but a pure virtual one makes the class useless.
I now use:
class VariantAnimation : public QVariantAnimation
{
Q_OBJECT
public:
VariantAnimation(QObject* parent = 0):
QVariantAnimation(parent) {}
protected:
virtual void updateCurrentValue(const QVariant& value)
};
I would have expected to be able to use QVariantAnimation directly, without having to subclass it.