QVariant isArray ?
-
Is there a generic way to identify if the data assigned to a QVariant is an array?
I know there is the type function, but I'm looking for something that may already exist before I re-invent the wheel.
-
@jsulm , I was looking for a generic way of determining if the data stored in the QVariant was singular or multiplies like a QByteArray.
I just wanted to know if there was already a way of determining this.
@SPlatten said in QVariant isArray ?:
I was looking for a generic way of determining if the data stored in the QVariant was singular or multiplies
Short answer: no
Long answer: it depends how you are using it.
QVariant::type()
will return an enum value to let you know what is the type of the stored value.
To be able to store a value into aQVariant
, this value has to be already known or register withQ_DECLARE_METATYPE()
QVariant::type() will let you know the variable type, and then you can get the according value with QVariant::value<TypeOfTheVariable>() -
@jsulm , I was looking for a generic way of determining if the data stored in the QVariant was singular or multiplies like a QByteArray.
I just wanted to know if there was already a way of determining this.