createBaseColour question


#1

I just created a subclass of LookAndFeel to customize ComboBox drawing, only to find that I can’t compile a straight copy of the parent class’ code in mine due to a call to createBaseColour(), which is a static function outside of the LookAndFeel class.

I’m sure its outside the class for a reason, but since it’s in the implementation file, and not referenced in the header, and since it’s not part of the class, subclasses can’t call it.

Could that routine be made part of the LookAndFeel class, or changed in some other way so that a LookAndFeel subclass can still find, and use it?


#2

Well… I don’t really see it as belonging in the base lookandfeel class, but I see your problem. Not sure what the elegant solution is there. If I were you I’d just copy it into your own code, probably.


#3

Copying createBaseColour() into my subclass was the easiest solution, and what I eventually did, but as you pointed out, it feels inelegant.

Is there a technical reason for that function to be static, and outside the LookAndFeel class?


#4

Only because if it were part of the class, it’d be inherited by any subclass, to which it might be completely meaningless. So I hid it away.