Searching an entire QListView

Sebastian Kratzert skratzert at gmx.de
Sun Jul 14 14:02:05 UTC 2002


Am Sonntag, 14. Juli 2002 01:26 schrieb Victor Röder:
> Hi!
>
> I wanted to ask if someone of you has a nice solution for searching
> QListView. I'm trying to write a little search mechanism for the
> Documentation-Panel of Gideon.
> Problem while searching: The children of an item are not created and
> initialized unless you open the item. Therefore you have to open each item,
> search it and close it again (so that the tree doesn't get too large) if
> nothing was found in that part of the tree.
> Has someone of you code where I can have a look? Or a complete solution
> :-)?
>
> The problem is *not* searching the list view with firstChild(),
> itemBelow(), etc. Just "How to search the list view efficiently?" (maybe
> :-)
>
> Bye,
> 	Victor
>
> _______________________________________________
> Kdevelop-devel mailing list
> Kdevelop-devel at barney.cs.uni-potsdam.de
> http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

Maybe this is what you want:

QListViewItem * QListView::findItem ( const QString & text, int column, 
ComparisonFlags compare = ExactMatch | CaseSensitive ) const

Finds the first list view item in column column, that matches text and returns 
the item, or returns 0 of no such item could be found. Pass OR-ed together 
Qt::StringComparisonMode values in the compare flag, to control how the 
matching is performed. The default comparison mode is case-sensitive, exact 
match. 

(copied from qt-docs)

-- 
Cheers,

Sebastian Kratzert





More information about the KDevelop-devel mailing list