[Kst] extragear/graphics/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Wed May 25 19:54:23 CEST 2005
SVN commit 418125 by rchern:
Add a filter text box accepting wildcards for the multiple edit widget
M +22 -2 editmultiplewidget.ui
M +16 -0 editmultiplewidget.ui.h
--- trunk/extragear/graphics/kst/kst/editmultiplewidget.ui #418124:418125
@@ -27,7 +27,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QListBox" row="0" column="0">
+ <widget class="QListBox" row="1" column="0" rowspan="1" colspan="2">
<item>
<property name="text">
<string>New Item</string>
@@ -40,7 +40,7 @@
<enum>Multi</enum>
</property>
</widget>
- <widget class="QLayoutWidget" row="0" column="1">
+ <widget class="QLayoutWidget" row="0" column="2" rowspan="2" colspan="1">
<property name="name">
<cstring>layout8_2</cstring>
</property>
@@ -100,6 +100,19 @@
</widget>
</grid>
</widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Filter:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>filterEdit</cstring>
+ </property>
+ </widget>
</grid>
</widget>
</grid>
@@ -117,12 +130,19 @@
<receiver>objectList</receiver>
<slot>clearSelection()</slot>
</connection>
+ <connection>
+ <sender>filterEdit</sender>
+ <signal>textChanged(const QString&)</signal>
+ <receiver>EditMultipleWidget</receiver>
+ <slot>applyFilter(const QString&)</slot>
+ </connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">editmultiplewidget.ui.h</include>
</includes>
<slots>
<slot>selectAllObjects()</slot>
+ <slot>applyFilter( const QString & filter )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
--- trunk/extragear/graphics/kst/kst/editmultiplewidget.ui.h #418124:418125
@@ -9,8 +9,24 @@
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
+#include <qregexp.h>
+
void EditMultipleWidget::selectAllObjects()
{
objectList->clearSelection();
objectList->invertSelection();
}
+
+void EditMultipleWidget::applyFilter(const QString& filter)
+{
+ objectList->clearSelection();
+
+ // case insensitive and wildcards
+ QRegExp re(filter, true, true);
+
+ for (uint i = 0; i < objectList->count(); i++) {
+ if (re.exactMatch(objectList->text(i))) {
+ objectList->setSelected(i, true);
+ }
+ }
+}
More information about the Kst
mailing list