[Kalzium] Searching for an element

Carsten Niehaus cniehaus at gmx.de
Thu Jan 5 13:12:08 CET 2006


Hi

I am trying to implement the searching for an element. I would like to 
implement it like searching work in Konq: Find by typing. For programming I 
will add a KLineEdit somewhere and connect the search with a search.

This code returns a QList<Element*> with matching elements. Ok so far.

QList<Element*> KalziumDataObject::findElements( const QString& name )
{
QList<Element*> newList;

foreach( Element* e, ElementList ){
  if ( e->dataAsString( CDO::name ).contains( name, Qt::CaseInsensitive ) )
       newList << e;
  }

return newList;
}



My problem is the drawing. Pino, should I add a "SEARCH"-mode (to be set with 
setMode() or should I add a second QList<Element*> to the KalziumDataObject. 
That second list is empty on startup and will always be synced with the 
search. In the paintevent Kalzium would check if the element is in the list 
and if so, make it Qt::lightGray...

I am still not in the new architecture and need some handholding... :-)

Carsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kalzium/attachments/20060105/d5892cc7/attachment.pgp


More information about the Kalzium mailing list