Re: [Development] Should QObject::event() be protected or public?

2024-03-20 Thread apoenitz
On Mon, Mar 18, 2024 at 02:00:06PM +0100, Giuseppe D'Angelo via Development wrote: > 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

Re: [Development] Should QObject::event() be protected or public?

2024-03-19 Thread André Somers
On 18/03/2024 14:00, Giuseppe D'Angelo via Development wrote: 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

Re: [Development] Should QObject::event() be protected or public?

2024-03-19 Thread Schimkowitsch Robert
To add a user perspective to the discussion: Please keep things simple and consistent. Consistency is great, especially in large code bases. Changing access modifiers for an existing interface in a derived class is confusing. Due to the way the documentation is structured, it’s also hard to

Re: [Development] Should QObject::event() be protected or public?

2024-03-18 Thread Volker Hilsheimer via Development
On 18 Mar 2024, at 14:00, Giuseppe D'Angelo via Development wrote: 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

Re: [Development] Should QObject::event() be protected or public?

2024-03-18 Thread Giuseppe D'Angelo via Development
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

Re: [Development] Should QObject::event() be protected or public?

2024-03-18 Thread André Somers
Hey, On 18/03/2024 12:12, Giuseppe D'Angelo via Development wrote: Il 15/03/24 21:21, Jaroslaw Kobus via Development ha scritto: To the point: we are talking here about decreasing the visibility of a member function in a subclass. The virtuality of the method isn't relevant I guess, is it?

Re: [Development] Should QObject::event() be protected or public?

2024-03-18 Thread Edward Welbourne via Development
Giuseppe D'Angelo (18 March 2024 12:12) > Therefore, when one creates a QObject subclass with an event() > override, then: > > * either they didn't know about the fact that it was public in > QObject, and thought it was protected/private (because virtual > functions should normally be

Re: [Development] Should QObject::event() be protected or public?

2024-03-18 Thread Giuseppe D'Angelo via Development
Il 15/03/24 21:21, Jaroslaw Kobus via Development ha scritto: To the point: we are talking here about decreasing the visibility of a member function in a subclass. The virtuality of the method isn't relevant I guess, is it? It is relevant, since that's the whole problem: since event() is a

Re: [Development] Should QObject::event() be protected or public?

2024-03-16 Thread Konstantin Shegunov
On Sat, Mar 16, 2024 at 4:01 PM Marc Mutz via Development < development@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

Re: [Development] Should QObject::event() be protected or public?

2024-03-16 Thread Marc Mutz via Development
On 16.03.24 01:47, Konstantin Shegunov wrote: > On Fri, Mar 15, 2024 at 10:48 PM Marc Mutz via Development > mailto:development@qt-project.org>> wrote: > > The member variable thing sounds very wrong. I'd be surprised if it > compiled. [...] > struct A > { >  

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Konstantin Shegunov
On Fri, Mar 15, 2024 at 10:48 PM Marc Mutz via Development < development@qt-project.org> wrote: > The member variable thing sounds very wrong. I'd be surprised if it > compiled. Then you'd be surprised. > If it does, it's probably something new in C++23 or 26 whereby > you can use `using` for

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Marc Mutz via Development
On 15.03.24 21:21, Jaroslaw Kobus via Development wrote: [...] > Just found some reasoning, though not sure how much valid it is: > https://www.learncpp.com/cpp-tutorial/hiding-inherited-functionality/ > > Probably there are more resources about this topic in the internet. That page doesn't look

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Jaroslaw Kobus via Development
> From: Development on behalf of Giuseppe > D'Angelo via Development > Sent: Friday, March 15, 2024 8:58 PM > To: development@qt-project.org > Subject: Re: [Development] Should QObject::event() be protected or public? > > Il 15/03/24 19:22, Giuseppe D'Angelo via Development

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Giuseppe D'Angelo via Development
Il 15/03/24 19:22, Giuseppe D'Angelo via Development ha scritto: Il 15/03/24 19:17, Jaroslaw Kobus via Development ha scritto: +1. Typically, the designer of a subclass knows what he is doing. But it also happens that users of this class know better how to use it :) I'm not sure what this

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Ahmad Samir
On 15/3/24 19:57, Jean-Michaël Celerier wrote: There's nothing more frustrating that instantiating a C++ type on the stack like MyType foo; and having to call a function with: static_cast(foo).someVirtualMethod(); Or: foo.Base::someVirtualMethod(); [..] -- Ahmad Samir

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Giuseppe D'Angelo via Development
Il 15/03/24 19:17, Jaroslaw Kobus via Development ha scritto: +1. Typically, the designer of a subclass knows what he is doing. But it also happens that users of this class know better how to use it :) I'm not sure what this means. If you override `event()` (public in QObject) as e.g.

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Jaroslaw Kobus via Development
> From: Development on behalf of Thiago > Macieira > Sent: Friday, March 15, 2024 7:03 PM > To: development@qt-project.org > Subject: Re: [Development] Should QObject::event() be protected or public? > > On Friday, 15 March 2024 10:09:31 PDT Marc Mutz via Development wr

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Thiago Macieira
On Friday, 15 March 2024 11:03:19 PDT Thiago Macieira wrote: > On Friday, 15 March 2024 10:09:31 PDT Marc Mutz via Development wrote: > > I like simple rules. "Overrides should have the same access level as the > > initial virtual function." is a simple rule. > > Amend that to "... unless there's

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Thiago Macieira
On Friday, 15 March 2024 10:09:31 PDT Marc Mutz via Development wrote: > I like simple rules. "Overrides should have the same access level as the > initial virtual function." is a simple rule. Amend that to "... unless there's an explicit reason not to". With that, I'm ok. As you can still

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Jean-Michaël Celerier
There's nothing more frustrating that instantiating a C++ type on the stack like MyType foo; and having to call a function with: static_cast(foo).someVirtualMethod(); because "The base class is the interface" and all the overriding methods are marked private. This is just adding

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Marc Mutz via Development
On 15.03.24 18:31, Christian Kandeler via Development wrote: > On 3/15/24 18:09, Marc Mutz via Development wrote: >> I like simple rules. "Overrides should have the same access level as the >> initial virtual function." is a simple rule. > > But it makes no sense in general. The base class is the

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Christian Kandeler via Development
On 3/15/24 18:09, Marc Mutz via Development wrote: I like simple rules. "Overrides should have the same access level as the initial virtual function." is a simple rule. But it makes no sense in general. The base class is the interface, and overrides should have the least possible visibility

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Marc Mutz via Development
On 15.03.24 14:28, Volker Hilsheimer via Development wrote: >> On 15 Mar 2024, at 12:30, Marc Mutz via Development >> wrote: >> On 15.03.24 09:11, apoenitz wrote: >>> On Fri, Mar 15, 2024 at 07:16:59AM +, Marc Mutz via Development wrote: >> [...] Please note that this means that any

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Volker Hilsheimer via Development
> On 15 Mar 2024, at 12:30, Marc Mutz via Development > wrote: > On 15.03.24 09:11, apoenitz wrote: >> On Fri, Mar 15, 2024 at 07:16:59AM +, Marc Mutz via Development wrote: > [...] >>> Please note that this means that any override (and all new QObject >>> classes should contain one, since,

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Marc Mutz via Development
On 15.03.24 09:11, apoenitz wrote: > On Fri, Mar 15, 2024 at 07:16:59AM +, Marc Mutz via Development wrote: [...] >> Please note that this means that any override (and all new QObject >> classes should contain one, since, in case we ever need it, it might not >> be possible to add it after the

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread apoenitz
On Fri, Mar 15, 2024 at 07:16:59AM +, Marc Mutz via Development wrote: > Summary as of 2024-3-14 EOD: QObject::event() has to stay public. Ok. > Please note that this means that any override (and all new QObject > classes should contain one, since, in case we ever need it, it might not >

Re: [Development] Should QObject::event() be protected or public?

2024-03-15 Thread Marc Mutz via Development
Summary as of 2024-3-14 EOD: QObject::event() has to stay public. Please note that this means that any override (and all new QObject classes should contain one, since, in case we ever need it, it might not be possible to add it after the fact) should also be public. Thanks, Marc On 13.03.24

Re: [Development] Should QObject::event() be protected or public?

2024-03-13 Thread Ilya Fedin
On Wed, 13 Mar 2024 07:58:20 + Marc Mutz via Development wrote: > Hi, > > In API review, we detected some overrides that changed the access > specifier vis-a-vis the original virtual function > (https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Polymorphic_Classes > Item 5.3). > >

Re: [Development] Should QObject::event() be protected or public?

2024-03-13 Thread Jaroslaw Kobus via Development
:58 AM To: development@qt-project.org Subject: [Development] Should QObject::event() be protected or public? Hi, In API review, we detected some overrides that changed the access specifier vis-a-vis the original virtual function (https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews

Re: [Development] Should QObject::event() be protected or public?

2024-03-13 Thread Giuseppe D'Angelo via Development
Il 13/03/24 08:58, Marc Mutz via Development ha scritto: If you see any reason for QObject::event() to stay public in Qt 7 and not become protected, please speak up before we fork Qt 7.0 :) I am *positive* that there's code out there that just calls event() to deliver an event. (Maybe

[Development] Should QObject::event() be protected or public?

2024-03-13 Thread Marc Mutz via Development
Hi, In API review, we detected some overrides that changed the access specifier vis-a-vis the original virtual function (https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Polymorphic_Classes Item 5.3). One of them was a protected reimplementation of QObject::event() (which itself is