diff 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
line wrap: on
line diff
--- a/src/filestatuswidget.cpp	Thu Feb 23 11:44:50 2012 +0000
+++ b/src/filestatuswidget.cpp	Thu Feb 23 15:28:29 2012 +0000
@@ -446,6 +446,7 @@
         }
 
         QStringList files = m_fileStates.filesInState(s);
+        bool foundSomething = false;
 
         QStringList highPriority, lowPriority;
 
@@ -454,8 +455,11 @@
             if (finding) {
                 if (file.contains(m_searchText, Qt::CaseInsensitive)) {
                     highPriority.push_back(file);
+                    foundSomething = true;
                 }
                 continue;
+            } else {
+                foundSomething = true;
             }
 
             bool highlighted = false;
@@ -499,7 +503,7 @@
 
         setLabelFor(w, s, !highPriority.empty());
 
-        if (files.empty()) {
+        if (!foundSomething) {
             w->parentWidget()->hide();
         } else {
             w->parentWidget()->show();