QMapmap; map.insertMulti("fruit", QStringList() << "apple" << "banana"); map.insertMulti("fruit", QStringList() << "orange" << "pear"); // The map now contains: // "fruit" => {"apple", "banana", "orange", "pear"}
QMapIn this example, a QMap is created where the keys are integers and the values are QStrings. The insertMulti() method is used to insert two key-value pairs into the map. Package library: Qt Core Library.map; map.insertMulti(1, "apple"); map.insertMulti(2, "banana"); // The map now contains: // 1 => "apple" // 2 => "banana"