Hello,
this is my Code:
void SomeClass::searchIn_identifier_listWidget()
{
QList<Identifier*> tempList;
QString text0
= ui
->identifier_lineEdit_search_0
->text
();
QString text1
= ui
->identifier_lineEdit_search_1
->text
();
QString text2
= ui
->identifier_lineEdit_search_2
->text
();
QString text3
= ui
->identifier_lineEdit_search_3
->text
();
QString text4
= ui
->identifier_lineEdit_search_4
->text
();
for (int i = 0; i < Storage::identifier.count(); i++) {
if (Storage::identifier.at(i)->dataString.contains(text0,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text1,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text2,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text3,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text4,Qt::CaseInsensitive))
{
tempList << Storage::identifier.at(i);
}
}
ui->identifier_listWidget->clear();
for (int i = 0; i < tempList.count(); i++) {
QTest::qWait(1);
listWidget_addItemPlusTooltip(ui->identifier_listWidget,tempList.at(i)->dataString);
}
}
void SomeClass::searchIn_identifier_listWidget()
{
QList<Identifier*> tempList;
QString text0 = ui->identifier_lineEdit_search_0->text();
QString text1 = ui->identifier_lineEdit_search_1->text();
QString text2 = ui->identifier_lineEdit_search_2->text();
QString text3 = ui->identifier_lineEdit_search_3->text();
QString text4 = ui->identifier_lineEdit_search_4->text();
for (int i = 0; i < Storage::identifier.count(); i++) {
if (Storage::identifier.at(i)->dataString.contains(text0,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text1,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text2,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text3,Qt::CaseInsensitive) &&
Storage::identifier.at(i)->dataString.contains(text4,Qt::CaseInsensitive))
{
tempList << Storage::identifier.at(i);
}
}
ui->identifier_listWidget->clear();
for (int i = 0; i < tempList.count(); i++) {
QTest::qWait(1);
listWidget_addItemPlusTooltip(ui->identifier_listWidget,tempList.at(i)->dataString);
}
}
To copy to clipboard, switch view to plain text mode
So as you can see i want to search though someting in this case a QList and load the Strings into the ListWidget which match the search. The algorythm should stay like this I think. It takes like minutes until the Widget is filled with the new data. i have like 30 000 strings in this List. And all GUI should stay responsive to the user thats why the qWait is there. Maybe thats why it is so slow, but how can the GUI stay responsive without qwait?
What can I do???
Can somebody help me?
edit: Without qwait the whole GUI in ther widget where this QListWidget is is locked. And it also takes like 1 minute to process all data into the QListWidget
thx
Bookmarks