1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2003 Scott Wheeler <wheeler@kde.org>
4 SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
5 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#ifndef KTREEWIDGETSEARCHLINEWIDGET_H
11#define KTREEWIDGETSEARCHLINEWIDGET_H
12
13#include <QWidget>
14#include <kitemviews_export.h>
15#include <memory>
16
17class QModelIndex;
18class QTreeWidget;
19class KTreeWidgetSearchLine;
20
21/*!
22 * \class KTreeWidgetSearchLineWidget
23 * \inmodule KItemViews
24 *
25 * \brief Creates a widget featuring a KTreeWidgetSearchLine, a label with the text
26 * "Search" and a button to clear the search.
27 */
28class KITEMVIEWS_EXPORT KTreeWidgetSearchLineWidget : public QWidget
29{
30 Q_OBJECT
31
32public:
33 /*!
34 * Creates a KTreeWidgetSearchLineWidget for \a treeWidget with \a parent as the
35 * parent.
36 */
37 explicit KTreeWidgetSearchLineWidget(QWidget *parent = nullptr, QTreeWidget *treeWidget = nullptr);
38
39 ~KTreeWidgetSearchLineWidget() override;
40
41 /*!
42 * Returns a pointer to the search line.
43 */
44 KTreeWidgetSearchLine *searchLine() const;
45
46protected Q_SLOTS:
47 /*!
48 * Creates the widgets inside of the widget. This is called from the
49 * constructor via a single shot timer so that it it guaranteed to run
50 * after construction is complete. This makes it suitable for overriding in
51 * subclasses.
52 */
53 virtual void createWidgets();
54
55protected:
56 /*!
57 * Creates the search line. This can be useful to reimplement in cases where
58 * a KTreeWidgetSearchLine subclass is used.
59 *
60 * It is const because it is be called from searchLine(), which to the user
61 * doesn't conceptually alter the widget.
62 */
63 virtual KTreeWidgetSearchLine *createSearchLine(QTreeWidget *treeWidget) const;
64
65private:
66 std::unique_ptr<class KTreeWidgetSearchLineWidgetPrivate> const d;
67};
68
69#endif
70

source code of kitemviews/src/ktreewidgetsearchlinewidget.h