/usr/include/klftools/klfitemviewsearchtarget.h is in libklatexformula4-dev 4.0.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /***************************************************************************
* file klfitemviewsearchtarget.h
* This file is part of the KLatexFormula Project.
* Copyright (C) 2012 by Philippe Faist
* philippe.faist at bluewin.ch
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/* $Id: klfitemviewsearchtarget.h 953 2016-12-27 00:13:10Z phfaist $ */
#ifndef KLFITEMVIEWSEARCHTARGET_H
#define KLFITEMVIEWSEARCHTARGET_H
#include <QAbstractItemModel>
#include <QAbstractItemView>
#include <klfdefs.h>
#include <klfsearchbar.h>
#include <klfiteratorsearchable.h>
struct KLFItemViewSearchTargetPrivate;
//! A search target (for KLFSearchBar) for standard item views
/** Add search functionality to standard item views. Any item view you may have (QTreeView/QListView etc.)
* may be added search functionality with KLFSearchBar, using this class as search target.
*
* For basic usage, you should not need to interact more with this class than simply instantiating it and
* feeding it to KLFSearchBar as the search target with KLFSearchBar::setSearchTarget().
*
* Matches are displayed in highlighted red font, and current found item is displayed as selected.
*
* Minimal example:
* \code
* QTableView * view = ...;
* KLFSearchBar * searchBar = new KLFSearchBar(...);
* KLFItemViewSearchTarget * searchTarget = new KLFItemViewSearchTarget(view, this);
* searchBar->setSearchTarget(searchTarget);
* \endcode
*
* \todo Currently, to highlight search matches this class replaces the delegate with a custom delegate used
* to highlight search matches, thus relying on the fact that the default delegate is close to a standard
* QItemDelegate. TODO: define some "proxy" delegate, and just extend the delegate that is already set on
* the view.
*/
class KLFItemViewSearchTarget : public QObject, public KLFIteratorSearchable<QModelIndex>
{
Q_OBJECT
public:
KLFItemViewSearchTarget(QAbstractItemView * view, QObject *parent = NULL);
virtual ~KLFItemViewSearchTarget();
QAbstractItemView * view() ;
QList<int> searchColumns() ;
virtual QModelIndex searchIterAdvance(const QModelIndex &pos, bool forward);
virtual QModelIndex searchIterBegin();
virtual QModelIndex searchIterEnd();
virtual bool searchIterMatches(const QModelIndex &pos, const QString &queryString);
virtual void searchPerformed(const QModelIndex& resultMatchPosition, bool found,
const QString& queryString);
virtual void searchAborted();
virtual void searchReinitialized();
virtual void searchMoveToIterPos(const QModelIndex& pos);
void setSearchView(QAbstractItemView *view);
void setSearchColumns(const QList<int>& columnList);
private:
KLF_DECLARE_PRIVATE(KLFItemViewSearchTarget) ;
};
#endif
|