Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Cannot run TWO QListWidget in same function



  • The attached TEST code snippet will not update TWO QListWidget in same function.

    What is the reason for such behavior?

    Is there a reasonable way to make it work ?

    update and sleep does not work

    #ifdef BYPASS
    ui->list_2->insertItem(1,itemString);
    ui->list_2->update();
    //ui->list_2->insertItem(1,item);
    ui->list_2->addItem(item);
    ui->list_2->update();
    #endif
    //sleep(5);
    // original add to bluetooth devices found list
    ui->list->addItem(item);
    ui->list->update();



  • @AnneRanch
    The update()s won't have any visible effect. You will see the updates as & when you allow Qt to return to its event loop. If you uncomment the sleep(5) you will not see any update during the sleep. You should never use sleep() in a Qt UI application.


Log in to reply