Expose some classes as value types to QML
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Oxide |
Fix Released
|
Medium
|
Chris Coulson |
Bug Description
We have several classes that are only QObects because they need to be exposed to QML (eg, OxideQLoadEvent, OxideQDownloadR
- When used in signals, they have to be passed as pointers. This prevents them from being used in queued slots, unless they are dispatched in a QSharedPointer that can be shared between slots. QSharedPointer can't be used with QML though.
- When used in signals, the pointer passed to QML becomes invalid as soon as the stack unwinds. This means that if you implement WebView.
- OxideQSecurityS
Qtdeclarative has a private API for exposing custom value types (copyable types that aren't QObject) - see QQmlValueType. IIUC, in a future qtdeclarative release, there's a public mechanism for doing this (see https:/
Given that there's going to be a public way to do this, I think it would be worthwhile using the private API for current qtdeclarative releases (which isn't going to change anymore) before we adopt a newer release. Some candidates for converting to value types are LoadEvent, DownloadRequest and SslCertificate.
One thing I've wanted to do for a while is to have a stable C++ API, but I've been reluctant to commit to this because I've never really been happy with implementing everything as QObjects. This would be a stepping stone to having a stable C++ API.
Related branches
Changed in oxide: | |
importance: | Undecided → Medium |
status: | New → Triaged |
assignee: | nobody → Chris Coulson (chrisccoulson) |
description: | updated |
Changed in oxide: | |
status: | Triaged → Fix Released |
milestone: | none → branch-1.9 |