aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/v4/qv4value_p.h12
-rw-r--r--src/qml/qml/v4/qv4variantobject.cpp5
-rw-r--r--src/quick/items/qquickdrag.cpp6
-rw-r--r--src/quick/items/qquickdroparea.cpp6
4 files changed, 18 insertions, 11 deletions
diff --git a/src/qml/qml/v4/qv4value_p.h b/src/qml/qml/v4/qv4value_p.h
index 207ee22c7d..cc279543bf 100644
--- a/src/qml/qml/v4/qv4value_p.h
+++ b/src/qml/qml/v4/qv4value_p.h
@@ -151,11 +151,17 @@ struct Q_QML_EXPORT Value
inline bool isObject() const { return tag == Object_Type; }
#endif
inline bool isConvertibleToInt() const { return (tag & ConvertibleToInt) == ConvertibleToInt; }
- inline bool isInt32() const {
+ inline bool isInt32() {
if (tag == _Integer_Type)
return true;
- if (isDouble() && (int)dbl == dbl)
- return true;
+ if (isDouble()) {
+ int i = (int)dbl;
+ if (i == dbl) {
+ int_32 = i;
+ tag = _Integer_Type;
+ return true;
+ }
+ }
return false;
}
diff --git a/src/qml/qml/v4/qv4variantobject.cpp b/src/qml/qml/v4/qv4variantobject.cpp
index ddd60026a8..733f28994f 100644
--- a/src/qml/qml/v4/qv4variantobject.cpp
+++ b/src/qml/qml/v4/qv4variantobject.cpp
@@ -72,8 +72,9 @@ QVariant VariantObject::toVariant(const QV4::Value &v)
if (v.isBoolean())
return QVariant(v.booleanValue());
if (v.isNumber()) {
- if (v.isInt32())
- return QVariant(v.toInt32());
+ QV4::Value val = v;
+ if (val.isInt32())
+ return QVariant(val.integerValue());
return QVariant(v.asDouble());
}
if (v.isNull())
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 14bd4b5870..55b3e569ef 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -517,9 +517,9 @@ void QQuickDragAttached::start(QQmlV4Function *args)
Qt::DropActions supportedActions = d->supportedActions;
// check arguments for supportedActions, maybe data?
if (args->length() >= 1) {
- v8::Handle<v8::Value> v = (*args)[0];
- if (v->IsInt32()) {
- supportedActions = Qt::DropActions(v->Int32Value());
+ QV4::Value v = (*args)[0];
+ if (v.isInt32()) {
+ supportedActions = Qt::DropActions(v.integerValue());
d->overrideActions = true;
}
}
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index 3b8f02db8c..f930835bee 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -421,9 +421,9 @@ void QQuickDropEvent::accept(QQmlV4Function *args)
Qt::DropAction action = event->dropAction();
if (args->length() >= 1) {
- v8::Handle<v8::Value> v = (*args)[0];
- if (v->IsInt32())
- action = Qt::DropAction(v->Int32Value());
+ QV4::Value v = (*args)[0];
+ if (v.isInt32())
+ action = Qt::DropAction(v.integerValue());
}
// get action from arguments.
event->setDropAction(action);