# HG changeset patch # User Chris Cannam # Date 1222705909 0 # Node ID 4a5fe547128266647290ff7653146298e17e6a81 # Parent 374b72f5b4bbb0a95a7f6cbd814c6313c3abc0c5 * More transform finder stuff diff -r 374b72f5b4bb -r 4a5fe5471282 widgets/SelectableLabel.cpp --- 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); diff -r 374b72f5b4bb -r 4a5fe5471282 widgets/TransformFinder.cpp --- 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
") - .arg(m_sortedResults[i].score) + labelText += tr("%1
") .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