10.000 items take some time to create and add.
Print_Descendants_key must not touch/access the ListWidget from the other thread. that will not be good.
To make the UI less hanged while adding such a number of items, you can do 3 things.
1: use a View + custom model instead.
If you already have all the data in a list/vector, a custom model on top of that would be super fast.
Use a thread to send data to main. Make sure the thread is not hammering the
main gui as that would lag too. You can also use a QTimer and simply slow down the adding.
Do the ugly trick of calling QApplication::processEvents() (in the loop that adds the items)
to allow the main GUI to be more responsive.