On 18/03/2024 13:34, André Somers wrote:
While I know it's easy to work around, I sometimes find myself doing it anyway. To me, it signals what API is intended to be used in what way. That a class overrides `event` (or any other public virtual method) does not mean that that method is then intended to be called by a user of the class as the type you defined. That you overwrote it may just be an implementation detail. I think the methods you expose as "public" on an API are quite important*. They signal how the user is supposed to use an instance of your class. If you have methods in there that are just implementation details, then those don't fit. These methods are meant to be called by parts of the system that don't see your type as the actual type, but as something more basic: a QObject in this case.
But I agree 100% here; this is typically realized in C++ by having the entry point public and non-virtual, and have that dispatch to a protected virtual. The whole problem we're discussing is that `event()` has been made public in the base class and that means it's now public API of any QObject subclass, whether they like it or not. :-(
-- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - Trusted Software Excellence
smime.p7s
Description: S/MIME Cryptographic Signature
-- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development