I am trying to use a textbox that searches as you type. I have written some basic code that works perfect for smaller list, but not for big ones. I just connect this to the test edits changed signal. Is there anything I can do to speed this up?

Qt Code:
  1. QString searchText = ui->lineEdit->text();
  2. int listWidgetSize = ui->listWidget->count();
  3.  
  4. for (int k1 = 0; k1 < listWidgetSize; k1++)
  5. {
  6. if (ui->listWidget->item(k1)->text().startsWith(searchText))
  7. {
  8. ui->listWidget->item(k1)->setHidden(false)
  9. }
  10. else
  11. {
  12. ui->listWidget->item(k1)->setHidden(true);
  13. }
  14. }
To copy to clipboard, switch view to plain text mode 

Thanks guys!