Here's what I did . . .
I defined the structure like this:
QMap<int, QString> map;
map[100] = "event 1";
map[101] = "event 2";
map[102] = "event 3";
QMap<int, QString> map;
map[100] = "event 1";
map[101] = "event 2";
map[102] = "event 3";
To copy to clipboard, switch view to plain text mode
Then to lookup the human text where the incoming network data is "num"
int num = statusData[1].toInt();
QMap<int, QString>::const_iterator i = map.find(num);
while (i != map.end() && i.key() == num) {
qDebug() << "DEBUG: Status Definition = " << i.value();
machineStatusLabel->setText(tr("%1").arg(i.value()));
++i;
}
int num = statusData[1].toInt();
QMap<int, QString>::const_iterator i = map.find(num);
while (i != map.end() && i.key() == num) {
qDebug() << "DEBUG: Status Definition = " << i.value();
machineStatusLabel->setText(tr("%1").arg(i.value()));
++i;
}
To copy to clipboard, switch view to plain text mode
Works great...
Thanks.
Bookmarks