* GuiRef: improve filter UI

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33271 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-01-30 11:19:48 +00:00
parent d3487d106c
commit f6e81bbb95
3 changed files with 53 additions and 79 deletions

View File

@ -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

View File

@ -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 *);

View File

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>386</width>
<height>479</height>
<height>443</height>
</rect>
</property>
<property name="windowTitle" >
@ -22,6 +22,49 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="findKeysLA" >
<property name="text" >
<string>Fil&amp;ter:</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>findLE</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="findLE" >
<property name="toolTip" >
<string>Enter string to filter the label list</string>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="csFindCB" >
<property name="toolTip" >
<string>Filter case-sensitively</string>
</property>
<property name="text" >
<string>Case-sensiti&amp;ve</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
@ -305,70 +348,6 @@
<item row="1" column="0" colspan="3" >
<widget class="QTreeWidget" name="refsTW" />
</item>
<item row="2" column="0" colspan="3" >
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QCheckBox" name="csFindCB" >
<property name="text" >
<string>Case-sensiti&amp;ve</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="findLE" >
<property name="toolTip" >
<string>Enter the text to search for and press Enter or click the button to search</string>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="searchPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="toolTip" >
<string>Click or press Enter in the search box to search</string>
</property>
<property name="text" >
<string>&amp;Search</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="findKeysLA" >
<property name="text" >
<string>Searc&amp;h:</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>findLE</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>