QVariantMap map; map.insert("name", "Alice"); map.insert("age", 30); QVariantMap::const_iterator iter = map.constBegin(); while (iter != map.constEnd()) { QString key = iter.key(); QVariant value = iter.value(); qDebug() << key << ":" << value; ++iter; }In this example, a QVariantMap is created with two key-value pairs. A const_iterator is then used to iterate over the map and print out the key-value pairs. The package library for this code would be the Qt library.