D14513: Add QML Extensions API

David Rosca noreply at phabricator.kde.org
Sun Aug 12 10:35:01 BST 2018


drosca added inline comments.

INLINE COMMENTS

> drosca wrote in qmlextensionscheme.cpp:31
> I meant what I told you to do, just call `qmlEngine(this)->newQObject(request);`
> 
>   connect(m_schemeHandler, &QmlExtensionSchemeHandler::_requestStarted, this, [this](QWebEngineUrlRequestJob *job) {
>       QmlWebEngineUrlRequestJob *request = new QmlWebEngineUrlRequestJob(job);
>       qmlEngine(this)->newQObject(request);
>       emit requestStarted(request);
>   });

I asked you to test how it works, so what are your findings? I'm not myself sure if this is actually correct, as you may need to pass the QJSValue to QML (as you did) to not be garbage collected if the reference is held on QML side.
Eg. save the reference to the job on QML side and check if it is still valid after some time (with Timer).

> drosca wrote in qmli18n.cpp:26
> > i18n as contextProperty object
> 
> Is that an issue?
> 
> > It must be added to the engine at time of its creation i.e. remove singleton of i18n from QmlPlugins and move i18n to engine global object when the engine is created in QmlPluginLoader.
> 
> I don't see any problem with this.
> 
> If it works, please do it this way.

I don't think it should call `setlocale` at all, that's QLocale job. Take a look how is this done in `ki18n` framework.

> qmlpluginloader.cpp:73
> +    m_engine->globalObject().setProperty("__falkon_i18n", m_engine->newQObject(i18n));
> +    m_engine->globalObject().setProperty("i18n", m_engine->evaluate("function (s) { return __falkon_i18n.i18n(s) }"));
> +    m_engine->globalObject().setProperty("i18np", m_engine->evaluate("function (s1, s2) { return __falkon_i18n.i18np(s1, s2) }"));

QStringLiteral

REPOSITORY
  R875 Falkon

REVISION DETAIL
  https://phabricator.kde.org/D14513

To: anmolgautam, drosca
Cc: falkon, herrold, anmolgautam, SGOrava, iodelay, spoorun, ptabis, navarromorales, cochise, clivej, ach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/falkon/attachments/20180812/bafa9bad/attachment.html>


More information about the Falkon mailing list