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

Schimkowitsch Robert Robert.Schimkowitsch at andritz.com
Tue Mar 19 09:43:15 CET 2024


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 see in the docs.

Having to cast to the base class in order to access the interface is confusing. Do we bypass the implementation of the derived class? Of course not, but I wonder how many developers would stumble with that.



I see two clean approaches:

1) Make event() public consistently

2) Create a new non-virtual public interface in Qt 6.x that can be used to call event(). Document that public access to event() will be removed in Qt7, and people using it should migrate to the new interface. Then, in Qt 7, make the virtual functions protected consistently.



Option 2 would be the cleaner one, but some people may hate you for upsetting their codebase.



Kind regards



Robert

________________________________

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.

ANDRITZ HYDRO GmbH


Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806


Thank You
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240319/b338c5ed/attachment-0001.htm>


More information about the Development mailing list