[Development] QWebEnginePage and Qt 6: protected virtual functions and signals

Benjamin TERRIER b.terrier at gmail.com
Wed May 26 18:39:56 CEST 2021


Hi,

I just saw this ticket: https://bugreports.qt.io/browse/QTBUG-74587
and this related gerrit change:
https://codereview.qt-project.org/c/qt/qtwebengine/+/346723

I am not sure what to think about it.
Sure it is nice to be able to customize a QWebEnginePage without deriving
from it, but turning all protected functions
to signal seems a bit overkill and I would think it is exposing too much.
And it is replacing compile-time behavior with run-time behavior.

In particular, I like the ability to have my own class "MyWebEnginePage"
with customized behavior.
With protected functions, I can be sure that an instance of MyWebEnginePage
will behave as expected,
as defined at compile-time in the overridden functions. With the new API,
it will always be possible to connect/disconnect signals
at run-time, meaning that I have no guarantee on the behavior of a
MyWebEnginePage.

I'd like to suggest that we keep the old API (protected functions) and only
emit a signal if its associated function has not handled the event/request.
This way, users are still able to create their own MyWebEnginePage with
guarantees that it will behave as defined in the class functions.

Cheers,

Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20210526/19f29d3d/attachment.html>


More information about the Development mailing list