diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index 93f8193fc2..defc14856f 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -68,10 +68,10 @@ GuiRef::GuiRef(GuiView & lv) this, SLOT(changed_adaptor())); connect(referenceED, SIGNAL(textChanged(QString)), this, SLOT(changed_adaptor())); - connect(findLE, SIGNAL(returnPressed()), - this, SLOT(on_searchPB_clicked())); + connect(findLE, SIGNAL(textEdited(QString)), + this, SLOT(filterLabels())); connect(csFindCB, SIGNAL(clicked()), - this, SLOT(on_searchPB_clicked())); + this, SLOT(filterLabels())); connect(nameED, SIGNAL(textChanged(QString)), this, SLOT(changed_adaptor())); connect(refsTW, SIGNAL(itemClicked(QTreeWidgetItem *, int)), @@ -202,7 +202,6 @@ void GuiRef::groupToggled() void GuiRef::updateClicked() { - findLE->clear(); updateRefs(); } @@ -429,6 +428,9 @@ void GuiRef::redoRefs() refsTW->setUpdatesEnabled(true); refsTW->update(); + // redo filter + filterLabels(); + // Re-activate the emission of signals by these widgets. refsTW->blockSignals(false); referenceED->blockSignals(false); @@ -473,17 +475,11 @@ void GuiRef::gotoBookmark() } -void GuiRef::on_findLE_textChanged(const QString & text) +void GuiRef::filterLabels() { - searchPB->setDisabled(text.isEmpty()); -} - - -void GuiRef::on_searchPB_clicked() -{ - QTreeWidgetItemIterator it(refsTW); Qt::CaseSensitivity cs = csFindCB->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive; + QTreeWidgetItemIterator it(refsTW); while (*it) { (*it)->setHidden( (*it)->childCount() == 0 diff --git a/src/frontends/qt4/GuiRef.h b/src/frontends/qt4/GuiRef.h index 3f0abfe262..e240d0e939 100644 --- a/src/frontends/qt4/GuiRef.h +++ b/src/frontends/qt4/GuiRef.h @@ -34,8 +34,7 @@ public: private Q_SLOTS: void changed_adaptor(); void gotoClicked(); - void on_findLE_textChanged(const QString &); - void on_searchPB_clicked(); + void filterLabels(); void refHighlighted(QTreeWidgetItem *); void selectionChanged(); void refSelected(QTreeWidgetItem *); diff --git a/src/frontends/qt4/ui/RefUi.ui b/src/frontends/qt4/ui/RefUi.ui index b74883e17e..f97bbbdc38 100644 --- a/src/frontends/qt4/ui/RefUi.ui +++ b/src/frontends/qt4/ui/RefUi.ui @@ -6,7 +6,7 @@ 0 0 386 - 479 + 443 @@ -22,6 +22,49 @@ 6 + + + + 0 + + + 6 + + + + + Fil&ter: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + findLE + + + + + + + Enter string to filter the label list + + + + + + + + + + Filter case-sensitively + + + Case-sensiti&ve + + + + + @@ -305,70 +348,6 @@ - - - - QFrame::StyledPanel - - - QFrame::Plain - - - - 9 - - - 6 - - - - - Case-sensiti&ve - - - - - - - Enter the text to search for and press Enter or click the button to search - - - - - - - - - - false - - - Click or press Enter in the search box to search - - - &Search - - - false - - - - - - - Searc&h: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - findLE - - - - - -