Does anyone know why big int values on QVariant store as double ?
-
I'm not sure what do you mean but QVariant works fine with maximum value of int
@#include <QCoreApplication>
#include <QDebug>
#include <limits>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);int x = INT_MAX; qDebug() << QVariant(x).toInt(); return a.exec();
}
@You can past a snippet in case that's not what you mean.
-
this outputs the following in the console for me:
[quote]QVariant(int, 2147483647)[/quote]Which compiler are you using?
-
[quote author="aabc" date="1367143234"]Try to use it this way:
@
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);int x = INT_MAX; QVariant v1 = x; qDebug() << v1; return a.exec();
}
@
[/quote]well..whats your output of these lines?!
-
show the code please.
-
C++:
@
class MyItem: public QObject
{
Q_OBJECTQ_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
public:
inline const QVariant& value() const
{
return m_value;
}inline void setValue(const QVariant& _value) { qDebug() << "_value = " << _value; qDebug() << "m_value = " << m_value; if(_value != m_value) { m_value = _value; emit valueChanged(); } }
private:
QVariant m_value;
}
@QML:
@
property int myQmlInt: 111111111MyItem
{
id: myItem1
value: myQmlInt
}
@