Skip to content

Register "qthelp" Web Engine URL scheme

From the documentation for QWebEngineUrlScheme::registerScheme():

It is recommended that all custom URL schemes are first registered with this function at application startup, even if the default options are to be used. Warning: This function must be called early at application startup, before creating any WebEngine classes. Late calls will be ignored.

=> register the scheme early at KDevelop's start to ensure it is not ignored. DocumentationController's constructor is called once and before plugins (which may create WebEngine classes) are loaded.

This gets rid of the following warning in KDevelop's output:

Please register the custom scheme 'qthelp' via QWebEngineUrlScheme::registerScheme() before installing the custom scheme handler.

Don't set the scheme syntax or flags. I have tried to set syntax to Host and flags to LocalScheme|LocalAccessAllowed, but haven't noticed any effect. In particular, the following type of warning in KDevelop's output wasn't eliminated by such tentative changes:

js: Not allowed to load local resource: file:///tmp/kdevelop.qWHueg

!108 (merged) first tried to register this scheme more than two years ago, but the registering was reverted as unrelated to the topic of the merge request. Note that the comment "Needs some ifqtversion>=5.12, same for #include" from that merge request is no longer relevant as KDevelop requires Qt 5.15.0 or later.

Edited by Igor Kushnir

Merge request reports