Descendants of MuseScoreView class override its member functions incorrectly

• Oct 15, 2018 - 14:29
Reported version
3.0
Priority
P1 - High
Type
Development
Severity
S4 - Minor
Status
active
Regression
No
Workaround
No
Project

Not sure whether this should be a bug report or a task since it doesn't currently affect any visible behavior of MuseScore. So I marked it a task, feel free to correct this.

The problem I would like to describe is the following.
MuseScoreView class has some number of member functions which can be overridden in its descendants. PianoRoll and ExampleView as well as ScoreView are descendants of MuseScoreView and apparently try to override some of its member functions. However these overriding functions are not marked with override keyword and some of them have wrong signatures so that they effectively override nothing. One example of this is cmdAddSlur function which has different signatures in MuseScoreView and PianoRoll. The only reason it doesn't affect anything is that those overrides are actually doing nothing. However it doesn't seem to be a good decision to leave this situation as it is.

ScoreView also has some functions overridden from MuseScoreView which are not marked with override keyword but I didn't see any wrong signatures in those functions.

So I would propose to:
1) Correct signatures of those incorrect overrides or remove those overrides which are not really necessary.
2) Mark those functions with override keyword to ensure that this situation will not repeat again.

Feel free to correct me if I am wrong in this.


Comments

I guess at least part of that code pre-dates C++11 (in which override was introduced).

But yes, adding it where appropriate (overriding virtual functions) will indeed prevent signature mismatches at compile time, so that's definitely a good thing to do!