changeset 425:4a5fe5471282

* More transform finder stuff
author Chris Cannam
date Mon, 29 Sep 2008 16:31:49 +0000
parents 374b72f5b4bb
children 6bf3c906b7a5
files widgets/SelectableLabel.cpp widgets/TransformFinder.cpp
diffstat 2 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/SelectableLabel.cpp	Mon Sep 29 15:06:43 2008 +0000
+++ b/widgets/SelectableLabel.cpp	Mon Sep 29 16:31:49 2008 +0000
@@ -35,6 +35,7 @@
 void
 SelectableLabel::setUnselectedText(QString text)
 {
+    if (m_unselectedText == text) return;
     m_unselectedText = text;
     if (!m_selected) {
         setText(m_unselectedText);
@@ -45,6 +46,7 @@
 void
 SelectableLabel::setSelectedText(QString text)
 {
+    if (m_selectedText == text) return;
     m_selectedText = text;
     if (m_selected) {
         setText(m_selectedText);
@@ -63,8 +65,8 @@
             (QString("QLabel:hover { background: %1; color: %3; } "
                      "QLabel:!hover { background: %2; color: %3 } "
                      "QLabel { padding: 7px }")
-             .arg(palette.button().color().name())
-             .arg(palette.mid().color().light().name())
+             .arg(palette.mid().color().lighter(120).name())
+             .arg(palette.mid().color().lighter(140).name())
              .arg(palette.text().color().name()));
     } else {
         setWordWrap(false);
--- a/widgets/TransformFinder.cpp	Mon Sep 29 15:06:43 2008 +0000
+++ b/widgets/TransformFinder.cpp	Mon Sep 29 16:31:49 2008 +0000
@@ -90,7 +90,7 @@
     m_upToDateCount = 0;
     m_timer = new QTimer(this);
     connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
-    m_timer->start(0);
+    m_timer->start(30);
 }
 
 TransformFinder::~TransformFinder()
@@ -147,7 +147,9 @@
         return;
     }
 
-    if (m_upToDateCount < m_sortedResults.size()) {
+    if (m_upToDateCount >= m_sortedResults.size()) return;
+
+    while (m_upToDateCount < m_sortedResults.size()) {
 
         int i = m_upToDateCount;
 
@@ -158,8 +160,7 @@
             (m_sortedResults[i].transform);
 
         QString labelText;
-        labelText += tr("%1: %2<br><small>")
-            .arg(m_sortedResults[i].score)
+        labelText += tr("%1<br><small>")
             .arg(XmlExportable::encodeEntities(desc.name));
 
         labelText += "...";
@@ -201,17 +202,20 @@
         m_labels[i]->setObjectName(desc.identifier);
         m_labels[i]->setFixedWidth(this->width() - 40);
         m_labels[i]->setUnselectedText(labelText);
+
+//        std::cerr << "selected text: " << selectedText.toStdString() << std::endl;
         m_labels[i]->setSelectedText(selectedText);
 
         m_labels[i]->setSelected(m_selectedTransform == desc.identifier);
-        m_labels[i]->show();
+
+        if (!m_labels[i]->isVisible()) m_labels[i]->show();
 
         ++m_upToDateCount;
 
-//        if (m_upToDateCount == m_sortedResults.size()) {
-            m_resultsFrame->resize(m_resultsFrame->sizeHint());
-//        }
+        if (i == 0) break;
     }
+
+    m_resultsFrame->resize(m_resultsFrame->sizeHint());
 }
 
 void