]> git.lyx.org Git - features.git/commitdiff
* GuiRef: improve filter UI
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 30 Jan 2010 11:19:48 +0000 (11:19 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 30 Jan 2010 11:19:48 +0000 (11:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33271 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiRef.cpp
src/frontends/qt4/GuiRef.h
src/frontends/qt4/ui/RefUi.ui

index 93f8193fc2d8546e9607e1a7aad98ec33c26bb2c..defc14856f194d28141409fb90644a05b04e2f1b 100644 (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
index 3f0abfe2624dd700ad1a743faf313a62b101f110..e240d0e939e36f6935835d6ab27cc34f22869f01 100644 (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 *);
index b74883e17e1c48c1c1c3b43d7a4f32ec49286a82..f97bbbdc38f670a48f380290ee60ed02471a92d6 100644 (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" >
    <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" >
    <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>