Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.2
-
None
Description
When invoking a C++ method from Qt with a QVariant parameter which was defined in QML as a double, if that double lies on a whole number boundary, it is passed as a QVariant(int) rather than a QVariant(double)
property double test1 = 1.0 property double test2 = 1.1 function testDouble() { CCode.test_value(test1); CCode.test_value(test2); }
class CCode : public QObject { Q_OBJECT public: Q_INVOKABLE void test_value(const QVariant& value) { qDebug() << value; } }
Output:
QVariant(int, 1)
QVariant(double, 1.1)