Home > Mobile >  QVariant class object how to preserve an integer array?
QVariant class object how to preserve an integer array?

Time:09-15

QVariant class object how to preserve an integer array, or any other type array?
Have seen QVariant class object can hold a string array, an array of bytes, but didn't see save an integer array, floating point Numbers group, such as how to save?

CodePudding user response:

Bytearray containing
All arrays can be converted to an array of bytes

CodePudding user response:

Converted to an array of bytes, then there is a problem, how to read and distinguish is an integer or a floating point number, do not go into a deposit is a floating point number, read don't know is what type

CodePudding user response:

QVariant can preserve the custom in the template type

 
QList Dl;
Dl & lt; <0.1 & lt; <0.2 & lt; <0.3;

QVariant v.

//save
V. etValue (dl);

//read
If (v.c anConvert ())
Dl=v.v alue (a);
  •  Tags:  
  • Qt
  • Related