If you derive from a QObject, directly or through something else that does, then your class inherits all the virtual event handler functions. In your class declaration you can chose to use the 'virtual' keyword or not but the result is the same, the function will be virtual either way. That is:
...
protected:
// is exactly the same as
// void childEvent ( QChildEvent * event );
...
};
class Floober: public QObject {
...
protected:
virtual void childEvent ( QChildEvent * event );
// is exactly the same as
// void childEvent ( QChildEvent * event );
...
};
To copy to clipboard, switch view to plain text mode
Some people include "virtual" as an aide-mémoire to those who need to maintain the software later. I have seen claims that the ARM CC compiler issues a warning if the "virtual" is not present in derived classes: cannot vouch for that.
Bookmarks