In my dialog i have qlistwidget and a "refresh-list" button, when i click refresh-list `button` this function

```
Print_Descendants_key(exc.pUIAutomation, nullptr, 0);

```

should run and it populates my qlistwidget with around 10000 items, but until this function prepares and adds 10000 items in my qlistwidget ,the UI remains frozen ,i am not able to see list-items being added sequentially but after a period of 2 mins of being unresponsive, it suddenly becomes perfectly responsive.

How to tackle this ?? my desired effect is that,when this function is running , i should be able to see the elements adding up one-by-one/realtime in the QListwidget while the UI remains resonsive.

Note (My try):- to acheive my desired effect, i have tried running that `Print_Descendants_key(exc.pUIAutomation, nullptr, 0);` function in a separate thread named "thread3" , and when i click `refresh` button, i was able to see the list-items being added in-front of me and the UI remained resposive, but i had a problem, when i clicked "Ok" ENTIRE UI CRASHES, i get errors in either `qlist.h` or `abort.cpp` The way i did it was like this---

```
void Dialog::on_refreshbutton_clicked()
{
    std::thread thread3(&KeyComd::Print_step,this);
    thread3.detach(); 
}
void KeyComd::Print_step()
{
    Print_Descendants_key(exc.pUIAutomation, nullptr, 0);
}

```