00001 /*************************************************************************** 00002 * file klfitemviewsearchtarget.h 00003 * This file is part of the KLatexFormula Project. 00004 * Copyright (C) 2012 by Philippe Faist 00005 * philippe.faist at bluewin.ch 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 /* $Id$ */ 00023 00024 00025 #ifndef KLFITEMVIEWSEARCHTARGET_H 00026 #define KLFITEMVIEWSEARCHTARGET_H 00027 00028 #include <QAbstractItemModel> 00029 #include <QAbstractItemView> 00030 00031 #include <klfdefs.h> 00032 #include <klfsearchbar.h> 00033 #include <klfiteratorsearchable.h> 00034 00035 00036 struct KLFItemViewSearchTargetPrivate; 00037 00039 00060 class KLFItemViewSearchTarget : public QObject, public KLFIteratorSearchable<QModelIndex> 00061 { 00062 Q_OBJECT 00063 public: 00064 KLFItemViewSearchTarget(QAbstractItemView * view, QObject *parent = NULL); 00065 virtual ~KLFItemViewSearchTarget(); 00066 00067 QAbstractItemView * view() ; 00068 QList<int> searchColumns() ; 00069 00070 virtual QModelIndex searchIterAdvance(const QModelIndex &pos, bool forward); 00071 virtual QModelIndex searchIterBegin(); 00072 virtual QModelIndex searchIterEnd(); 00073 00074 virtual bool searchIterMatches(const QModelIndex &pos, const QString &queryString); 00075 virtual void searchPerformed(const QModelIndex& resultMatchPosition, bool found, 00076 const QString& queryString); 00077 virtual void searchAborted(); 00078 virtual void searchReinitialized(); 00079 virtual void searchMoveToIterPos(const QModelIndex& pos); 00080 00081 void setSearchView(QAbstractItemView *view); 00082 void setSearchColumns(const QList<int>& columnList); 00083 private: 00084 KLF_DECLARE_PRIVATE(KLFItemViewSearchTarget) ; 00085 }; 00086 00087 00088 00089 00090 00091 00092 #endif