Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cannot run TWO QListWidget in same function
Qt 6.11 is out! See what's new in the release blog

Cannot run TWO QListWidget in same function

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 243 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    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();

    JonBJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      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();

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @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.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved