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

Allan Sandfeld Jensen kde at carewolf.com
Thu May 27 11:25:16 CEST 2021


On Wednesday, 26 May 2021 18:39:56 CEST Benjamin TERRIER wrote:
> 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 am not sure I see a significant difference. They are both compile-time. A 
"user" of your widget could also derive it and override the virtual function 
just as well as they could override your the signals?

Best regards
'Allan




More information about the Development mailing list