I’m trying to loop through a QHash using foreach and get each pair in the QHash and then get the keys and values of those so I can append them to a string.
Here’s what I have
QString Packet::Serialize() {
QString sBuilder = Command.toUpper() + " ";
foreach(QMap<QString,QString> pair, Attributes) {
sBuilder.append(pair); // i know this isn't right because I couldn't
// finish the statement
}
}
The variable Attributes is the QHash.
Also, I realize the code is probably 100% wrong because I’m converting it from C#.
Looks like you’re trying to append each key/value pair to a string? Something like this would work: