[Qtwebengine] new QML window API
Simon Hausmann
simon.hausmann at digia.com
Fri Jan 3 11:43:07 CET 2014
On Thursday 2. January 2014 17.09.32 Jocelyn Turcotte wrote:
> Hello,
>
> I've been chatting with Simon about this on IRC and after having put aside
> most issues that I raised in my "After trying to get it work and try it
> out, here is the snapshot.." comment at <https://trello.com/c/oGyDWKlQ> we
> came to the conclusion that the choice between his suggested simple
> component approach vs. the current API is the power that a signal handler
> (current API) would give vs. the convenience of not having to instantiate
> the component manually and have the adoption done behind the scene through
> the creation QQmlContext (API in this email).
>
> There are still two important bugs in the way to get something reliable:
> https://bugreports.qt-project.org/browse/QTBUG-35910
> https://bugreports.qt-project.org/browse/QTBUG-35913
>
> Once we have this solved we can try to implement it properly. The current
> "onCreateWindow" API will stay experimental until 1.0 anyway and we can try
> out a few things before committing to a public API.
>
> That said, this means that the current experimental new window API will
> change soon if everything goes right.
I think finally it's going to look pretty simple. Without any new window stuff,
you'd write it like this:
TabView {
Tab {
WebView { }
}
}
With new-tab support, we'd replace the "Tab" with "Component":
TabView {
Component {
id: newTabFactory
WebView {
newWindowComponent: newTabFactory
}
}
// Initial tab for example:
Tab {
component: newTabFactory
onLoaded: item.url = "http://initial-url.com/"
}
// Dynamically created tabs:
function dynamicFoo() {
var tab = addTab("", newTabFactory)
}
}
And the web view doesn't need to know anything about tabs.
I'll talk to the compo^H^Hcontrols folks about automatic support for propagating a title property from the created component.
Simon
More information about the QtWebEngine
mailing list