QVariantHash hash; hash.insert("name", QVariant("John")); hash.insert("age", QVariant(30));
QVariantHash hash; hash.insert("name", QVariant("John")); hash.insert("age", QVariant(30)); QString name = hash.value("name").toString(); // returns "John" int age = hash.value("age").toInt(); // returns 30
QVariantHash hash; hash.insert("name", QVariant("John")); hash.insert("age", QVariant(30)); for (auto it = hash.begin(); it != hash.end(); it++) { QString key = it.key(); QVariant value = it.value(); qDebug() << key << ": " << value.toString(); }The package library for QVariantHash would be Qt core library.