comparison src/filestatuswidget.cpp @ 557:57a7f95ef400 find

Make find widget behave as if text is cleared when it's closed, and restored when it's opened again
author Chris Cannam
date Thu, 23 Feb 2012 15:28:29 +0000
parents a1d210c767ab
children d932ce55c364
comparison
equal deleted inserted replaced
556:04f18b2a32e8 557:57a7f95ef400
444 w->parentWidget()->hide(); 444 w->parentWidget()->hide();
445 continue; 445 continue;
446 } 446 }
447 447
448 QStringList files = m_fileStates.filesInState(s); 448 QStringList files = m_fileStates.filesInState(s);
449 bool foundSomething = false;
449 450
450 QStringList highPriority, lowPriority; 451 QStringList highPriority, lowPriority;
451 452
452 foreach (QString file, files) { 453 foreach (QString file, files) {
453 454
454 if (finding) { 455 if (finding) {
455 if (file.contains(m_searchText, Qt::CaseInsensitive)) { 456 if (file.contains(m_searchText, Qt::CaseInsensitive)) {
456 highPriority.push_back(file); 457 highPriority.push_back(file);
458 foundSomething = true;
457 } 459 }
458 continue; 460 continue;
461 } else {
462 foundSomething = true;
459 } 463 }
460 464
461 bool highlighted = false; 465 bool highlighted = false;
462 466
463 if (s == FileStates::Unknown) { 467 if (s == FileStates::Unknown) {
497 item->setSelected(selectedFiles.contains(file)); 501 item->setSelected(selectedFiles.contains(file));
498 } 502 }
499 503
500 setLabelFor(w, s, !highPriority.empty()); 504 setLabelFor(w, s, !highPriority.empty());
501 505
502 if (files.empty()) { 506 if (!foundSomething) {
503 w->parentWidget()->hide(); 507 w->parentWidget()->hide();
504 } else { 508 } else {
505 w->parentWidget()->show(); 509 w->parentWidget()->show();
506 ++visibleCount; 510 ++visibleCount;
507 } 511 }