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-only
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 ktreewidgetsearchlinewidget.h KTreeWidgetSearchLineWidget
23 *
24 * Creates a widget featuring a KTreeWidgetSearchLine, a label with the text
25 * "Search" and a button to clear the search.
26 */
27class KITEMVIEWS_EXPORT KTreeWidgetSearchLineWidget : public QWidget
28{
29 Q_OBJECT
30
31public:
32 /**
33 * Creates a KTreeWidgetSearchLineWidget for \a treeWidget with \a parent as the
34 * parent.
35 */
36 explicit KTreeWidgetSearchLineWidget(QWidget *parent = nullptr, QTreeWidget *treeWidget = nullptr);
37
38 /**
39 * Destroys the KTreeWidgetSearchLineWidget
40 */
41 ~KTreeWidgetSearchLineWidget() override;
42
43 /**
44 * Returns a pointer to the search line.
45 */
46 KTreeWidgetSearchLine *searchLine() const;
47
48protected Q_SLOTS:
49 /**
50 * Creates the widgets inside of the widget. This is called from the
51 * constructor via a single shot timer so that it it guaranteed to run
52 * after construction is complete. This makes it suitable for overriding in
53 * subclasses.
54 */
55 virtual void createWidgets();
56
57protected:
58 /**
59 * Creates the search line. This can be useful to reimplement in cases where
60 * a KTreeWidgetSearchLine subclass is used.
61 *
62 * It is const because it is be called from searchLine(), which to the user
63 * doesn't conceptually alter the widget.
64 */
65 virtual KTreeWidgetSearchLine *createSearchLine(QTreeWidget *treeWidget) const;
66
67private:
68 std::unique_ptr<class KTreeWidgetSearchLineWidgetPrivate> const d;
69};
70
71#endif
72

source code of kitemviews/src/ktreewidgetsearchlinewidget.h