Merge lp:~aacid/oxide/qt54_variantjs into lp:~oxide-developers/oxide/oxide.trunk
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 954 | ||||
| Proposed branch: | lp:~aacid/oxide/qt54_variantjs | ||||
| Merge into: | lp:~oxide-developers/oxide/oxide.trunk | ||||
| Diff against target: |
82 lines (+30/-11) 2 files modified
qt/quick/api/oxideqquickwebcontextdelegateworker.cc (+18/-9) qt/quick/api/oxideqquickwebframe.cc (+12/-2) |
||||
| To merge this branch: | bzr merge lp:~aacid/oxide/qt54_variantjs | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Chris Coulson | 2015-02-05 | Approve on 2015-02-11 | |
|
Review via email:
|
|||
Commit Message
Adapt to behaviour change in handling of QVariants from QML to C++ in Qt 5.4
[QTBUG-40431] When a JavaScript object/array is passed to C++ through
a QVariant, the engine no longer immediately converts the object
recursively into a QVariantMap or QVariantList but instead stores a
QJSValue in the QVariant. This prevents a loss of data when the JS
object contains non-primitive types such as function objects for
example. Code that expects the variant type to be exactly
QVariant::Map or QVariant::List may need to be adapted. Registered
conversion functions however ensure that code that merely calls
toMap() or toList() continues to work. Fixes: https:/
| Olivier Tilloy (osomon) wrote : | # |
| Timo Jyrinki (timo-jyrinki) wrote : | # |
I'll build it against Qt 5.4 once there's a version of the patch that applies to either 1.4 or 1.5. Olivier is looking at it.
| Timo Jyrinki (timo-jyrinki) wrote : | # |
Ok I've it rebased for 1.4 (just some fuzz) and it'd apply against 1.5 fine. I'll report once the armhf 1.4 build patched with this branch has finished building.
| Chris Coulson (chrisccoulson) wrote : | # |
This Qt change kind of sucks - it's effectively an API break in what should be a stable API. It also means that if existing objects without a QtQml dependency have QVariant properties, they need to add a QtQml dependency for the object to be usable in Qml when they really only needed a QtCore dependency before.
If developers wanted to avoid a loss of data in the case where the JS object contains non-primitive types, surely they would just expose a QJSValue rather than using QVariant and making existing users of QVariant jump through an extra hoop (where we just discard the non-primitive types anyway, resulting in the same loss of data as before)?
| Albert Astals Cid (aacid) wrote : | # |
> This Qt change kind of sucks
Agreed
> It also means that if existing objects without a QtQml dependency have QVariant properties,
> they need to add a QtQml dependency for the object to be usable in Qml when they really only
> needed a QtCore dependency before.
Or they need to stop checking for the type of things, checking for the type of a QVariant is not a great idea when there's canConvert that will do the right thing.
> If developers wanted to avoid a loss of data in the case where the JS object contains
> non-primitive types, surely they would just expose a QJSValue rather than using QVariant and
> making existing users of QVariant jump through an extra hoop (where we just discard the
> non-primitive types anyway, resulting in the same loss of data as before)?
I didn't do that change, so i can't provide any more insight than the changelog entry.
| Chris Coulson (chrisccoulson) wrote : | # |
I'll approve this as I guess we'll need to do it anyway. It's a shame they couldn't have fixed that bug another way though
| Chris Coulson (chrisccoulson) wrote : | # |
And thanks for fixing it

Looks good to me, and I’ve verified that the unit tests still pass with Qt 5.3.
Haven’t tested with Qt 5.4 yet.