]> cloud.milkyroute.net Git - dolphin.git/blob - src/filterbar/filterbar.h
Build with QT_NO_KEYWORDS
[dolphin.git] / src / filterbar / filterbar.h
1 /*
2 * SPDX-FileCopyrightText: 2006-2010 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2006 Gregor Kališnik <gregor@podnapisi.net>
4 * SPDX-FileCopyrightText: 2012 Stuart Citrin <ctrn3e8@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #ifndef FILTERBAR_H
10 #define FILTERBAR_H
11
12 #include <QWidget>
13
14 class QLineEdit;
15 class QToolButton;
16
17 /**
18 * @brief Provides an input field for filtering the currently shown items.
19 *
20 * @author Gregor Kališnik <gregor@podnapisi.net>
21 */
22 class FilterBar : public QWidget
23 {
24 Q_OBJECT
25
26 public:
27 explicit FilterBar(QWidget* parent = nullptr);
28 ~FilterBar() override;
29
30 /** Called by view container to hide this **/
31 void closeFilterBar();
32
33 /**
34 * Selects the whole text of the filter bar.
35 */
36 void selectAll();
37
38 public Q_SLOTS:
39 /** Clears the input field. */
40 void clear();
41 /** Clears the input field if the "lock button" is disabled. */
42 void slotUrlChanged();
43 /** The input field is cleared also if the "lock button" is released. */
44 void slotToggleLockButton(bool checked);
45
46 Q_SIGNALS:
47 /**
48 * Signal that reports the name filter has been
49 * changed to \a nameFilter.
50 */
51 void filterChanged(const QString& nameFilter);
52
53 /**
54 * Emitted as soon as the filterbar should get closed.
55 */
56 void closeRequest();
57
58 /*
59 * Emitted as soon as the focus should be returned back to the view.
60 */
61 void focusViewRequest();
62
63 protected:
64 void showEvent(QShowEvent* event) override;
65 void keyReleaseEvent(QKeyEvent* event) override;
66
67 private:
68 QLineEdit* m_filterInput;
69 QToolButton* m_lockButton;
70 };
71
72 #endif