/usr/include/KF5/KItemViews/klistwidgetsearchline.h is in libkf5itemviews-dev 5.44.0-0ubuntu1.
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | /*
This file is part of the KDE libraries
Copyright (c) 2003 Scott Wheeler <wheeler@kde.org>
Copyright (c) 2004 Gustavo Sverzut Barbieri <gsbarbieri@users.sourceforge.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KLISTWIDGETSEARCHLINE_H
#define KLISTWIDGETSEARCHLINE_H
#include <QLineEdit>
#include <kitemviews_export.h>
class QListWidget;
class QListWidgetItem;
class QModelIndex;
/**
* @class KListWidgetSearchLine klistwidgetsearchline.h KListWidgetSearchLine
*
* This class makes it easy to add a search line for filtering the items in a
* listwidget based on a simple text search.
*
* No changes to the application other than instantiating this class with an
* appropriate QListWidget should be needed.
*/
class KITEMVIEWS_EXPORT KListWidgetSearchLine : public QLineEdit
{
Q_OBJECT
#ifndef KITEMVIEWS_NO_DEPRECATED
Q_PROPERTY(QString clickMessage READ clickMessage WRITE setClickMessage)
#endif
public:
/**
* Constructs a KListWidgetSearchLine with \a listWidget being the QListWidget to
* be filtered.
*
* If \a listWidget is null then the widget will be disabled until a listWidget
* is set with setListWidget().
*/
explicit KListWidgetSearchLine(QWidget *parent = nullptr,
QListWidget *listWidget = nullptr);
/**
* Destroys the KListWidgetSearchLine.
*/
virtual ~KListWidgetSearchLine();
/**
* Returns if the search is case sensitive. This defaults to Qt::CaseInsensitive.
*
* @see setCaseSensitive()
*/
Qt::CaseSensitivity caseSensitive() const;
/**
* Returns the listWidget that is currently filtered by the search.
*
* @see setListWidget()
*/
QListWidget *listWidget() const;
/**
* @return the message set with setClickMessage
* @deprecated since 5.0, use QLineEdit::placeholderText() instead.
**/
#ifndef KITEMVIEWS_NO_DEPRECATED
KITEMVIEWS_DEPRECATED QString clickMessage() const { return placeholderText(); }
#endif
/**
* This makes the line edit display a grayed-out hinting text as long as
* the user didn't enter any text. It is often used as indication about
* the purpose of the line edit.
* @deprecated since 5.0, use QLineEdit::setPlaceholderText() instead.
*/
#ifndef KITEMVIEWS_NO_DEPRECATED
KITEMVIEWS_DEPRECATED void setClickMessage(const QString &msg) { setPlaceholderText(msg); }
#endif
public Q_SLOTS:
/**
* Updates search to only make visible the items that match \a s. If
* \a s is null then the line edit's text will be used.
*/
virtual void updateSearch(const QString &s = QString());
/**
* Make the search case sensitive or case insensitive.
*
* @see caseSenstive()
*/
void setCaseSensitivity(Qt::CaseSensitivity cs);
/**
* Sets the QListWidget that is filtered by this search line. If \a lv is null
* then the widget will be disabled.
*
* @see listWidget()
*/
void setListWidget(QListWidget *lv);
/**
* Clear line edit and empty hiddenItems, returning elements to listWidget.
*/
void clear();
protected:
/**
* Returns true if \a item matches the search \a s. This will be evaluated
* based on the value of caseSensitive(). This can be overridden in
* subclasses to implement more complicated matching schemes.
*/
virtual bool itemMatches(const QListWidgetItem *item,
const QString &s) const;
/**
* Re-implemented for internal reasons. API not affected.
*/
bool event(QEvent *event) Q_DECL_OVERRIDE;
private:
class KListWidgetSearchLinePrivate;
KListWidgetSearchLinePrivate *const d;
Q_PRIVATE_SLOT(d, void _k_listWidgetDeleted())
Q_PRIVATE_SLOT(d, void _k_queueSearch(const QString &))
Q_PRIVATE_SLOT(d, void _k_activateSearch())
Q_PRIVATE_SLOT(d, void _k_rowsInserted(const QModelIndex &, int, int))
Q_PRIVATE_SLOT(d, void _k_dataChanged(const QModelIndex &, const QModelIndex &))
};
#endif /* KLISTWIDGETSEARCHLINE_H */
|