\sa find(), findNext(), findPrevious(), findFirst()
*/
+
+//------------------------------------------------------------------------------
+
+
+
/*!
- \class QtxTreeViewSearcher
- \brief A QTreeView class based searcher.
+ \class QtxViewSearcher
+ \brief Abstract base class for all searchers based on QAbstractItemModel.
- The class QtxTreeViewSearcher can be used to find the items in the
- QTreeView widget.
+ Derived classes should implement the following methods:
+ - void showItem( const QModelIndex& ) that highlights the found item
+ in the target view,
+ - QModelIndexList selectedItems() that returns the current selection
+ in the target view,
+ - QAbstractItemModel* model() that returns the underlying QAbstractItemModel
+ the target view works with.
The column for which data should be searched can be get/set with the
searchColumn(), setSearchColumn() methods.
By default, column 0 is used.
+
+ \sa QtxTreeViewSearcher, QtxItemViewSearcher
*/
/*!
\param col column for which search to be performed (0 by default)
\sa setSearchColumn()
*/
-QtxTreeViewSearcher::QtxTreeViewSearcher( QTreeView* view, int col )
- : myView( view ), myColumn( col )
+QtxViewSearcher::QtxViewSearcher( int col )
+ : myColumn( col )
{
}
/*!
\brief Destructor.
*/
-QtxTreeViewSearcher::~QtxTreeViewSearcher()
+QtxViewSearcher::~QtxViewSearcher()
{
}
\return column number
\sa setSearchColumn()
*/
-int QtxTreeViewSearcher::searchColumn() const
+int QtxViewSearcher::searchColumn() const
{
return myColumn;
}
\param column column number
\sa searchColumn()
*/
-void QtxTreeViewSearcher::setSearchColumn( int column )
+void QtxViewSearcher::setSearchColumn( int column )
{
myColumn = column;
}
\param st search tool widget
\sa findNext(), findPrevious(), findFirst(), findLast()
*/
-bool QtxTreeViewSearcher::find( const QString& text, QtxSearchTool* st )
+bool QtxViewSearcher::find( const QString& text, QtxSearchTool* st )
{
- if ( !myView )
- return false;
-
- const QModelIndexList& l = myView->selectionModel() ?
- myView->selectionModel()->selectedIndexes() : QModelIndexList();
+ QModelIndexList l = selectedItems();
QModelIndex current;
if ( l.count() > 0 )
\param st search tool widget
\sa find(), findPrevious(), findFirst(), findLast()
*/
-bool QtxTreeViewSearcher::findNext( const QString& text, QtxSearchTool* st )
+bool QtxViewSearcher::findNext( const QString& text, QtxSearchTool* st )
{
- if ( !myView )
- return false;
-
- const QModelIndexList& l = myView->selectionModel() ?
- myView->selectionModel()->selectedIndexes() : QModelIndexList();
+ QModelIndexList l = selectedItems();
QModelIndex current;
if ( l.count() > 0 )
\param st search tool widget
\sa find(), findNext(), findFirst(), findLast()
*/
-bool QtxTreeViewSearcher::findPrevious( const QString& text, QtxSearchTool* st )
+bool QtxViewSearcher::findPrevious( const QString& text, QtxSearchTool* st )
{
- if ( !myView )
- return false;
-
- const QModelIndexList& l = myView->selectionModel() ?
- myView->selectionModel()->selectedIndexes() : QModelIndexList();
+ QModelIndexList l = selectedItems();
QModelIndex current;
if ( l.count() > 0 )
\param st search tool widget
\sa find(), findNext(), findPrevious(), findLast()
*/
-bool QtxTreeViewSearcher::findFirst( const QString& text, QtxSearchTool* st )
+bool QtxViewSearcher::findFirst( const QString& text, QtxSearchTool* st )
{
QModelIndexList found = findItems( text, st );
\param st search tool widget
\sa find(), findNext(), findPrevious(), findFirst()
*/
-bool QtxTreeViewSearcher::findLast( const QString& text, QtxSearchTool* st )
+bool QtxViewSearcher::findLast( const QString& text, QtxSearchTool* st )
{
QModelIndexList found = findItems( text, st );
\brief Get match flags to be used by the searcher.
\param st search tool widget
*/
-Qt::MatchFlags QtxTreeViewSearcher::matchFlags( QtxSearchTool* st ) const
+Qt::MatchFlags QtxViewSearcher::matchFlags( QtxSearchTool* st ) const
{
Qt::MatchFlags fl = Qt::MatchRecursive;
\param text text to be found
\param st search tool widget
*/
-QModelIndexList QtxTreeViewSearcher::findItems( const QString& text, QtxSearchTool* st )
+QModelIndexList QtxViewSearcher::findItems( const QString& text, QtxSearchTool* st )
{
QString s = text;
s.append( ".*" );
}
- if ( myView->model() )
- return myView->model()->match( myView->model()->index( 0, myColumn ),
- Qt::DisplayRole,
- s, -1, fl );
+ if ( model() )
+ return model()->match( model()->index( 0, myColumn ),
+ Qt::DisplayRole,
+ s, -1, fl );
return QModelIndexList();
}
\param direction if \c true find next appropriate item, otherwise find privious
appropriate item
*/
-QModelIndex QtxTreeViewSearcher::findNearest( const QModelIndex& index,
- const QModelIndexList& lst,
- bool direction )
+QModelIndex QtxViewSearcher::findNearest( const QModelIndex& index,
+ const QModelIndexList& lst,
+ bool direction )
{
if ( direction )
{
}
/*!
+ \fn QtxViewSearcher::selectedItems() const
+ \brief Returns the currently selected model indices
+ \return List of model indices, empty list if nothing is selected
+*/
+
+/*!
+ \fn QtxViewSearcher::showItem( const QModelIndex& index )
\brief Ensure the found item to become visible and selected.
- \internal
\param index item to be shown
*/
-void QtxTreeViewSearcher::showItem( const QModelIndex& index )
-{
- if ( myView && index.isValid() && myView->selectionModel() )
- {
- QItemSelectionModel::SelectionFlags f =
- QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear;
- myView->selectionModel()->select( index, f );
- myView->scrollTo( index );
- myIndex = index;
- }
-}
+
+/*!
+ \fn QtxViewSearcher::model() const
+ \brief Returns an instance of QAbstractItemModel used by the view
+ \return Pointer to QAbstractItemModel instance
+*/
/*!
\brief Get unique item ID.
- \internal
\param index model index
\return item ID
*/
-QString QtxTreeViewSearcher::getId( const QModelIndex& index )
+QModelIndexList QtxViewSearcher::getId( const QModelIndex& index ) const
{
- QStringList ids;
+ QModelIndexList idxList;
QModelIndex p = index;
while ( p.isValid() )
{
- ids.prepend( QString::number( p.row() ) );
+ idxList.prepend( p );
p = p.parent();
}
- ids.prepend( "0" );
- return ids.join( ":" );
+ return idxList;
}
/*!
\brief Compare items.
- \internal
\param left first model index to be compared
\param right last model index to be compared
\return 0 if items are equal, negative value if left item is less than right one
and positive value otherwise
*/
-int QtxTreeViewSearcher::compareIndices( const QModelIndex& left,
- const QModelIndex& right )
+int QtxViewSearcher::compareIndices( const QModelIndex& left,
+ const QModelIndex& right ) const
{
- QString leftId = getId( left );
- QString rightId = getId( right );
-
- QStringList idsLeft = leftId.split( ":", QString::SkipEmptyParts );
- QStringList idsRight = rightId.split( ":", QString::SkipEmptyParts );
-
+ QModelIndexList idsLeft = getId( left );
+ QModelIndexList idsRight = getId( right );
for ( int i = 0; i < idsLeft.count() && i < idsRight.count(); i++ )
{
- int lid = idsLeft[i].toInt();
- int rid = idsRight[i].toInt();
- if ( lid != rid )
- return lid - rid;
+ QModelIndex lid = idsLeft[i];
+ QModelIndex rid = idsRight[i];
+ if ( lid.row() != rid.row() )
+ return lid.row() - rid.row();
+ else if ( lid.column() != rid.column() )
+ return lid.column() - rid.column();
}
return idsLeft.count() < idsRight.count() ? -1 :
( idsLeft.count() == idsRight.count() ? 0 : 1 );
}
+//------------------------------------------------------------------------------
+/*!
+ \class QtxTreeViewSearcher
+ \brief A QTreeView class based searcher.
+ The class QtxTreeViewSearcher can be used to find the items in the
+ QTreeView widget.
+ QtxTreeViewSearcher is provided for backward compatibility only,
+ QtxItemViewSearcher class is a more generic tool that works with any
+ QAbstractItemView-derived class.
+ The column for which data should be searched can be get/set with the
+ searchColumn(), setSearchColumn() methods.
+ By default, column 0 is used.
-
-
-
-
-
-
+ \sa QtxViewSearcher, QtxItemViewSearcher
+*/
/*!
\brief Constructor.
\param col column for which search to be performed (0 by default)
\sa setSearchColumn()
*/
-QtxItemViewSearcher::QtxItemViewSearcher( QAbstractItemView* view, int col )
- : myView( view ), myColumn( col )
+QtxTreeViewSearcher::QtxTreeViewSearcher( QTreeView* view, int col )
+ : QtxViewSearcher( col ),
+ myView( view )
{
}
/*!
\brief Destructor.
*/
-QtxItemViewSearcher::~QtxItemViewSearcher()
+QtxTreeViewSearcher::~QtxTreeViewSearcher()
{
}
/*!
- \brief Get column for which search is performed.
- \return column number
- \sa setSearchColumn()
+ \brief Provided for compatibility.
*/
-int QtxItemViewSearcher::searchColumn() const
+bool QtxTreeViewSearcher::find( const QString& text, QtxSearchTool* st )
{
- return myColumn;
+ return QtxViewSearcher::find( text, st );
}
/*!
- \brief Set column for which search should be performed.
- \param column column number
- \sa searchColumn()
+ \brief Provided for compatibility.
*/
-void QtxItemViewSearcher::setSearchColumn( int column )
+bool QtxTreeViewSearcher::findNext( const QString& text, QtxSearchTool* st )
{
- myColumn = column;
+ return QtxViewSearcher::findNext( text, st );
}
/*!
- \brief Start new search.
- \param text text to be found
- \param st search tool widget
- \sa findNext(), findPrevious(), findFirst(), findLast()
+ \brief Provided for compatibility.
*/
-bool QtxItemViewSearcher::find( const QString& text, QtxSearchTool* st )
+bool QtxTreeViewSearcher::findPrevious( const QString& text, QtxSearchTool* st )
{
- if ( !myView )
- return false;
-
- const QModelIndexList& l = myView->selectionModel() ?
- myView->selectionModel()->selectedIndexes() : QModelIndexList();
-
- QModelIndex current;
- if ( l.count() > 0 )
- current = l.first();
-
- bool wrapSearch = st->isSearchWrapped();
-
- QModelIndexList found = findItems( text, st );
-
- if ( found.count() > 0 )
- {
- if ( !current.isValid() )
- {
- showItem( found.first() );
- return true;
- }
-
- if ( found.contains( current ) )
- {
- showItem( current );
- return true;
- }
-
- QModelIndex next = findNearest( current, found, true );
- if ( next.isValid() )
- {
- showItem( next );
- return true;
- }
-
- if ( wrapSearch )
- {
- showItem( found.first() );
- return true;
- }
- }
-
- return false;
+ return QtxViewSearcher::findPrevious( text, st );
}
/*!
- \brief Search next appropriate item.
- \param text text to be found
- \param st search tool widget
- \sa find(), findPrevious(), findFirst(), findLast()
+ \brief Provided for compatibility.
*/
-bool QtxItemViewSearcher::findNext( const QString& text, QtxSearchTool* st )
+bool QtxTreeViewSearcher::findFirst( const QString& text, QtxSearchTool* st )
{
- if ( !myView )
- return false;
-
- const QModelIndexList& l = myView->selectionModel() ?
- myView->selectionModel()->selectedIndexes() : QModelIndexList();
-
- QModelIndex current;
- if ( l.count() > 0 )
- current = l.first();
- else if ( myIndex.isValid() )
- current = myIndex;
-
- bool wrapSearch = st->isSearchWrapped();
-
- QModelIndexList found = findItems( text, st );
-
- if ( found.count() > 0 )
- {
- if ( !current.isValid() )
- {
- showItem( found.first() );
- return true;
- }
-
- QModelIndex next = findNearest( current, found, true );
- if ( next.isValid() )
- {
- showItem( next );
- return true;
- }
-
- if ( wrapSearch )
- {
- showItem( found.first() );
- return true;
- }
- }
-
- return false;
+ return QtxViewSearcher::findFirst( text, st );
}
/*!
- \brief Search previous appropriate item.
- \param text text to be found
- \param st search tool widget
- \sa find(), findNext(), findFirst(), findLast()
+ \brief Provided for compatibility.
*/
-bool QtxItemViewSearcher::findPrevious( const QString& text, QtxSearchTool* st )
+bool QtxTreeViewSearcher::findLast( const QString& text, QtxSearchTool* st )
{
- if ( !myView )
- return false;
-
- const QModelIndexList& l = myView->selectionModel() ?
- myView->selectionModel()->selectedIndexes() : QModelIndexList();
-
- QModelIndex current;
- if ( l.count() > 0 )
- current = l.first();
- else if ( myIndex.isValid() )
- current = myIndex;
-
- bool wrapSearch = st->isSearchWrapped();
-
- QModelIndexList found = findItems( text, st );
-
- if ( found.count() > 0 )
- {
- if ( !current.isValid() )
- {
- showItem( found.first() );
- return true;
- }
-
- QModelIndex next = findNearest( current, found, false );
- if ( next.isValid() )
- {
- showItem( next );
- return true;
- }
-
- if ( wrapSearch )
- {
- showItem( found.last() );
- return true;
- }
- }
-
- return false;
+ return QtxViewSearcher::findLast( text, st );
}
/*!
- \brief Search first appropriate item.
- \param text text to be found
- \param st search tool widget
- \sa find(), findNext(), findPrevious(), findLast()
+ \brief Ensure the found item to become visible and selected.
+ \param index item to be shown
*/
-bool QtxItemViewSearcher::findFirst( const QString& text, QtxSearchTool* st )
+void QtxTreeViewSearcher::showItem( const QModelIndex& index )
{
- QModelIndexList found = findItems( text, st );
-
- if ( found.count() > 0 )
+ if ( myView && index.isValid() && myView->selectionModel() )
{
- showItem( found.first() );
- return true;
+ QItemSelectionModel::SelectionFlags f =
+ QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear;
+ myView->selectionModel()->select( index, f );
+ myView->scrollTo( index );
+ setCurrentIndex( index );
}
-
- return false;
}
/*!
- \brief Search last appropriate item.
- \param text text to be found
- \param st search tool widget
- \sa find(), findNext(), findPrevious(), findFirst()
+ \brief Returns a list of model indices selected in myView
+ \return A list of model indices
*/
-bool QtxItemViewSearcher::findLast( const QString& text, QtxSearchTool* st )
+QModelIndexList QtxTreeViewSearcher::selectedItems() const
{
- QModelIndexList found = findItems( text, st );
-
- if ( found.count() > 0 )
- {
- showItem( found.last() );
- return true;
- }
-
- return false;
+ return ( myView && myView->selectionModel() ) ?
+ myView->selectionModel()->selectedIndexes() :
+ QModelIndexList();
}
/*!
- \brief Get match flags to be used by the searcher.
- \param st search tool widget
+ \brief Returns the model displayed in myView
+ \return Pointer to the model
*/
-Qt::MatchFlags QtxItemViewSearcher::matchFlags( QtxSearchTool* st ) const
+QAbstractItemModel* QtxTreeViewSearcher::model() const
{
- Qt::MatchFlags fl = Qt::MatchRecursive;
+ return myView ? myView->model() : 0;
+}
- if ( st->isCaseSensitive() )
- fl = fl | Qt::MatchCaseSensitive;
- if ( st->isRegExpSearch() )
- fl = fl | Qt::MatchRegExp;
- else
- fl = fl | Qt::MatchContains;
+//------------------------------------------------------------------------------
- return fl;
-}
/*!
- \brief Find all appropriate items.
- \internal
- \param text text to be found
- \param st search tool widget
-*/
-QModelIndexList QtxItemViewSearcher::findItems( const QString& text, QtxSearchTool* st )
-{
- QString s = text;
+ \class QtxItemViewSearcher
+ \brief A generic QAbstractItemView class based searcher.
- Qt::MatchFlags fl = matchFlags( st );
- if ( fl & Qt::MatchRegExp ) {
- if ( !s.startsWith( "^" ) && !s.startsWith( ".*" ) )
- s.prepend( ".*" );
- if ( !s.endsWith( "$" ) && !s.endsWith( ".*" ) )
- s.append( ".*" );
- }
+ The class QtxItemViewSearcher can be used to find the items in
+ any widget derived from QAbstractItemView class.
- if ( myView->model() )
- return myView->model()->match( myView->model()->index( 0, myColumn ),
- Qt::DisplayRole,
- s, -1, fl );
- return QModelIndexList();
+ \sa QtxViewSearcher, QtxItemViewSearcher
+*/
+
+/*!
+ \brief Constructor.
+ \param view tree view widget
+ \param col column for which search to be performed (0 by default)
+ \sa setSearchColumn()
+*/
+QtxItemViewSearcher::QtxItemViewSearcher( QAbstractItemView* view, int col )
+ : QtxViewSearcher( col ),
+ myView( view )
+{
}
/*!
- \brief Find model index from the list nearest to the specified index.
- \internal
- \param index model index for which a nearest item is searched
- \param lst list of model indices
- \param direction if \c true find next appropriate item, otherwise find privious
- appropriate item
+ \brief Destructor.
*/
-QModelIndex QtxItemViewSearcher::findNearest( const QModelIndex& index,
- const QModelIndexList& lst,
- bool direction )
+QtxItemViewSearcher::~QtxItemViewSearcher()
{
- if ( direction )
- {
- QListIterator<QModelIndex> it( lst );
- while ( it.hasNext() )
- {
- QModelIndex found = it.next();
- if ( compareIndices( found, index ) > 0 )
- return found;
- }
- }
- else
- {
- QListIterator<QModelIndex> it( lst );
- it.toBack();
- while ( it.hasPrevious() )
- {
- QModelIndex found = it.previous();
- if ( compareIndices( found, index ) < 0 )
- return found;
- }
- }
- return QModelIndex();
}
/*!
\brief Ensure the found item to become visible and selected.
- \internal
\param index item to be shown
*/
void QtxItemViewSearcher::showItem( const QModelIndex& index )
QItemSelectionModel::Select | QItemSelectionModel::Clear;
myView->selectionModel()->select( index, f );
myView->scrollTo( index );
- myIndex = index;
+ setCurrentIndex( index );
}
}
/*!
- \brief Get unique item ID.
- \internal
- \param index model index
- \return item ID
+ \brief Returns a list of model indices selected in myView
+ \return A list of model indices
*/
-QModelIndexList QtxItemViewSearcher::getId( const QModelIndex& index ) const
+QModelIndexList QtxItemViewSearcher::selectedItems() const
{
- QModelIndexList idxList;
- QModelIndex p = index;
- while ( p.isValid() )
- {
- idxList.prepend( p );
- p = p.parent();
- }
- return idxList;
+ return ( myView && myView->selectionModel() ) ?
+ myView->selectionModel()->selectedIndexes() :
+ QModelIndexList();
}
/*!
- \brief Compare items.
- \internal
- \param left first model index to be compared
- \param right last model index to be compared
- \return 0 if items are equal, negative value if left item is less than right one
- and positive value otherwise
+ \brief Returns the model displayed in myView
+ \return Pointer to the model
*/
-int QtxItemViewSearcher::compareIndices( const QModelIndex& left,
- const QModelIndex& right ) const
+QAbstractItemModel* QtxItemViewSearcher::model() const
{
- QModelIndexList idsLeft = getId( left );
- QModelIndexList idsRight = getId( right );
- for ( int i = 0; i < idsLeft.count() && i < idsRight.count(); i++ )
- {
- QModelIndex lid = idsLeft[i];
- QModelIndex rid = idsRight[i];
- if ( lid.row() != rid.row() )
- return lid.row() - rid.row();
- else if ( lid.column() != rid.column() )
- return lid.column() - rid.column();
- }
- return idsLeft.count() < idsRight.count() ? -1 :
- ( idsLeft.count() == idsRight.count() ? 0 : 1 );
+ return myView ? myView->model() : 0;
}
void resultChanged( bool );
};
-class QTX_EXPORT QtxTreeViewSearcher : public QtxSearchTool::Searcher
+
+class QTX_EXPORT QtxViewSearcher : public QtxSearchTool::Searcher
{
public:
- QtxTreeViewSearcher( QTreeView*, int = 0 );
- virtual ~QtxTreeViewSearcher();
+ QtxViewSearcher( int column = 0 );
+ virtual ~QtxViewSearcher();
- int searchColumn() const;
- void setSearchColumn( int );
-
- virtual bool find( const QString&, QtxSearchTool* );
- virtual bool findNext( const QString&, QtxSearchTool* );
- virtual bool findPrevious( const QString&, QtxSearchTool* );
- virtual bool findFirst( const QString&, QtxSearchTool* );
- virtual bool findLast( const QString&, QtxSearchTool* );
+ int searchColumn() const;
+ void setSearchColumn( int );
+
+ virtual bool find( const QString&, QtxSearchTool* );
+ virtual bool findNext( const QString&, QtxSearchTool* );
+ virtual bool findPrevious( const QString&, QtxSearchTool* );
+ virtual bool findFirst( const QString&, QtxSearchTool* );
+ virtual bool findLast( const QString&, QtxSearchTool* );
protected:
- virtual Qt::MatchFlags matchFlags( QtxSearchTool* ) const;
+ virtual Qt::MatchFlags matchFlags( QtxSearchTool* ) const;
+ virtual void showItem( const QModelIndex& ) = 0;
+ virtual QModelIndexList selectedItems() const = 0;
+ virtual QAbstractItemModel* model() const = 0;
+
+ inline void setCurrentIndex( const QModelIndex& index );
+ inline const QPersistentModelIndex& currentIndex() const;
private:
- QModelIndexList findItems( const QString&, QtxSearchTool* );
- QModelIndex findNearest( const QModelIndex&, const QModelIndexList&, bool );
- void showItem( const QModelIndex& );
- QString getId( const QModelIndex& );
- int compareIndices( const QModelIndex&, const QModelIndex& );
+ QModelIndexList findItems( const QString&, QtxSearchTool* );
+ QModelIndex findNearest( const QModelIndex&, const QModelIndexList&, bool );
+ QModelIndexList getId( const QModelIndex& ) const;
+ int compareIndices( const QModelIndex&, const QModelIndex& ) const;
private:
- QTreeView* myView;
- int myColumn;
- QPersistentModelIndex myIndex;
+ int myColumn;
+ QPersistentModelIndex myIndex;
};
-class QTX_EXPORT QtxItemViewSearcher : public QtxSearchTool::Searcher
+
+void QtxViewSearcher::setCurrentIndex( const QModelIndex& index )
{
-public:
- QtxItemViewSearcher( QAbstractItemView*, int = 0 );
- virtual ~QtxItemViewSearcher();
+ myIndex = index;
+}
- int searchColumn() const;
- void setSearchColumn( int );
+const QPersistentModelIndex& QtxViewSearcher::currentIndex() const
+{
+ return myIndex;
+}
+
+class QTX_EXPORT QtxTreeViewSearcher : public QtxViewSearcher
+{
+public:
+ QtxTreeViewSearcher( QTreeView*, int = 0 );
+ virtual ~QtxTreeViewSearcher();
- virtual bool find( const QString&, QtxSearchTool* );
- virtual bool findNext( const QString&, QtxSearchTool* );
- virtual bool findPrevious( const QString&, QtxSearchTool* );
- virtual bool findFirst( const QString&, QtxSearchTool* );
- virtual bool findLast( const QString&, QtxSearchTool* );
+ virtual bool find( const QString&, QtxSearchTool* );
+ virtual bool findNext( const QString&, QtxSearchTool* );
+ virtual bool findPrevious( const QString&, QtxSearchTool* );
+ virtual bool findFirst( const QString&, QtxSearchTool* );
+ virtual bool findLast( const QString&, QtxSearchTool* );
protected:
- virtual Qt::MatchFlags matchFlags( QtxSearchTool* ) const;
-
+ virtual void showItem( const QModelIndex& );
+ virtual QModelIndexList selectedItems() const;
+ virtual QAbstractItemModel* model() const;
+
private:
- QModelIndexList findItems( const QString&, QtxSearchTool* );
- QModelIndex findNearest( const QModelIndex&, const QModelIndexList&, bool );
- void showItem( const QModelIndex& );
- QModelIndexList getId( const QModelIndex& ) const;
- int compareIndices( const QModelIndex&, const QModelIndex& ) const;
+ QTreeView* myView;
+};
+
+class QTX_EXPORT QtxItemViewSearcher : public QtxViewSearcher
+{
+public:
+ QtxItemViewSearcher( QAbstractItemView*, int = 0 );
+ virtual ~QtxItemViewSearcher();
+
+protected:
+ virtual void showItem( const QModelIndex& );
+ virtual QModelIndexList selectedItems() const;
+ virtual QAbstractItemModel* model() const;
private:
- QAbstractItemView* myView;
- int myColumn;
- QPersistentModelIndex myIndex;
+ QAbstractItemView* myView;
};
#endif // QTXSEARCHTOOL_H