[Development] Should QObject::event() be protected or public?
Konstantin Shegunov
kshegunov at gmail.com
Sat Mar 16 23:00:00 CET 2024
On Sat, Mar 16, 2024 at 4:01 PM Marc Mutz via Development <
development at qt-project.org> wrote:
> Function != variable ;-)
>
Granted, they're different and using declarations are intended for and work
for _both_ functions and variables.
I was simply providing some context where this syntax is actually quite
useful, hence the usage of "You can ALSO use this for [...]".
That aside, is the principal discussion theoretical as it seem to have
strayed quite a lot?
I get your argument(s) and I mostly agree, in principle that is. Yet, to
give you a counter example: if you `protected` inherited some class you
might want to hide some of its (virtual) methods for derived classes and
make them private. This a valid use case I believe, and is probably why the
language allows you to do so, rightfully - I imagine some (edge) cases
where you may want to do this sort of thing.
So to summarize my opinion:
Should `QObject::event` be made `protected` - likely, yes - but you would
need to collect the use cases for the public method and provide a migration
path, to play nice with the users.
Should this be discouraged if possible - likely, yes.
Should this guideline be made a rule, a.k.a. chisel it in stone - hell no.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240317/9ce20ac3/attachment.htm>
More information about the Development
mailing list