[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Member Functions | List of all members
KLFSearchable Class Referenceabstract

An interface for objects that can be I-searched with a KLFSearchBar (OBSOLETE) More...

#include <klfsearchbar.h>

Inheritance diagram for KLFSearchable:
Inheritance graph
[legend]
Collaboration diagram for KLFSearchable:
Collaboration graph
[legend]

Public Member Functions

 KLFSearchable ()
 
virtual ~KLFSearchable ()
 
virtual bool searchFind (const QString &queryString, bool forward)=0
 Find the first occurence of a query string. More...
 
bool searchFind (const QString &queryString)
 Find the first occurence of a query string. More...
 
virtual bool searchFindNext (bool forward)=0
 Find next or previous occurence of query string. More...
 
virtual void searchAbort ()=0
 Abort I-Search. More...
 
virtual Pos searchFind (const QString &queryString, const Pos &fromPos, bool forward)
 
virtual void searchMoveToPos (const Pos &pos)
 
virtual void searchPerformed (const QString &queryString, bool found, const Pos &pos)
 
virtual void searchAborted ()
 
- Public Member Functions inherited from KLFPosSearchable
virtual Pos searchStartFrom (bool forward)
 
virtual void searchReinitialized ()
 
virtual QString searchQueryString () const
 The current query string. More...
 
virtual void setSearchQueryString (const QString &s)
 
virtual bool searchHasInterruptRequested ()
 
virtual void setSearchInterruptRequested (bool on)
 
- Public Member Functions inherited from KLFTarget
 KLFTarget ()
 
virtual ~KLFTarget ()
 

Additional Inherited Members

- Protected Attributes inherited from KLFTarget
QList< KLFTargeter * > pTargetOf
 

Detailed Description

An interface for objects that can be I-searched with a KLFSearchBar (OBSOLETE)

THIS CLASS IS OBSOLETE. Use KLFPosSearchable instead.

This class is the base skeleton interface for displays that will be targets for I-searches. There are three functions to reimplement:

virtual bool searchFind(const QString& queryString, bool forward);
virtual bool searchFindNext(bool forward);
virtual void searchAbort();

That have to actually perform the search.

It is not uncommon for the display widget itself to inherit also from a KLFSearchable. See KLFAbstractLibView and KLFLibDefautlView for an example (in klfapp library).

This class is pretty low-level search (you have to manually walk all items, remember the query string for future find-next operations, etc.). For a higher-level search implementation, see KLFIteratorSearchable (which itself is a KLFSearchable object and can also be used as target for KLFSearchBar).

Definition at line 346 of file klfsearchbar.h.

Constructor & Destructor Documentation

◆ KLFSearchable()

KLFSearchable::KLFSearchable ( )

Definition at line 240 of file klfsearchbar.cpp.

◆ ~KLFSearchable()

KLFSearchable::~KLFSearchable ( )
virtual

Definition at line 243 of file klfsearchbar.cpp.

Member Function Documentation

◆ searchAbort()

virtual void KLFSearchable::searchAbort ( )
pure virtual

Abort I-Search.

The behavior depends on the object/data being searched. This could be reimplemented for example to return to the beginning of the list, or to the position where the user was at the beginning of the search.

Implemented in KLFSearchableProxy.

◆ searchAborted()

virtual void KLFSearchable::searchAborted ( )
inlinevirtual

Implements KLFPosSearchable.

Definition at line 401 of file klfsearchbar.h.

◆ searchFind() [1/3]

virtual bool KLFSearchable::searchFind ( const QString queryString,
bool  forward 
)
pure virtual

Find the first occurence of a query string.

This function has to be reimplemented to find the first occurence of the string queryString, searching from top of the displayed information if forward is TRUE, or reverse from end of display of FALSE.

The reimplementation should call from time to time

qApp->processEvents()

to keep the GUI from freezing in long searches.

Note
If the reimplementation implements the above suggestion, note that the slot searchAbort() may be called during that time! It is best to take that into account and provide a means to stop the search if that is the case.

Implemented in KLFSearchableProxy.

◆ searchFind() [2/3]

bool KLFSearchable::searchFind ( const QString queryString)
inline

Find the first occurence of a query string.

This function is provided for calling convenience. Subclasses should reimplement searchFind(const QString&, bool) instead.

This function directly calls searchFind(const QString& bool) with the forward argument set to TRUE.

Definition at line 374 of file klfsearchbar.h.

References searchFind().

Referenced by searchFind().

◆ searchFind() [3/3]

KLFPosSearchable::Pos KLFSearchable::searchFind ( const QString queryString,
const Pos fromPos,
bool  forward 
)
virtual

◆ searchFindNext()

virtual bool KLFSearchable::searchFindNext ( bool  forward)
pure virtual

Find next or previous occurence of query string.

This function has to be reimplemented to find the next occurence of the query string given by a previous call to searchFind(). The search must be performed in the direction given by forward (see searchFind()).

It is up to the sub-class to remember the query string and the current match location.

This function should also call the applications's processEvents() to keep the GUI from freezing. See documentation in searchFind().

Implemented in KLFSearchableProxy.

◆ searchMoveToPos()

virtual void KLFSearchable::searchMoveToPos ( const Pos pos)
inlinevirtual

Reimplemented from KLFPosSearchable.

Definition at line 397 of file klfsearchbar.h.

◆ searchPerformed()

virtual void KLFSearchable::searchPerformed ( const QString queryString,
bool  found,
const Pos pos 
)
inlinevirtual

Reimplemented from KLFPosSearchable.

Definition at line 399 of file klfsearchbar.h.


The documentation for this class was generated from the following files:

Generated by doxygen 1.8.13