First: make your code readable. The indenting is a complete mess. Blocks of code at the same level (if, loops) should be aligned at the same level.
Your code to check whether an item is in the list, is broken. If you have 10 items in the list, you add the incoming string 9 times.
I would suggest to use QListWidget's findItems() method to check for the existence of an item.
The construction of your msg QString is suboptimal. You construct a default empty string and assign a newly created string afterwards. This is better:
@
QString msg(datagram);
@
Note, that QString has a constructor taking a QByteArray, there's no need to use the const char data pointer of the array.
Did you check that msg contains a proper string?