Clazy fix++
[kdepim.git] / kaddressbook / quicksearchwidget.h
blob6b8defc751de2d9c87b0c89e12ecf3ae461b9624
1 /*
2 This file is part of KAddressBook.
4 Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
11 This library is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA.
22 #ifndef QUICKSEARCHWIDGET_H
23 #define QUICKSEARCHWIDGET_H
25 #include <QWidget>
27 class QLineEdit;
29 /**
30 * @short The quick search widget from the toolbar
32 * This widget allows the user to filter for contacts
33 * that match a given string criteria.
34 * The filter string the user enters here is emitted to
35 * the ContactsFilterModel, which does the real filtering.
37 * @author Tobias Koenig <tokoe@kde.org>
39 class QuickSearchWidget : public QWidget
41 Q_OBJECT
43 public:
44 /**
45 * Creates the quick search widget.
47 * @param parent The parent widget.
49 explicit QuickSearchWidget(QWidget *parent = Q_NULLPTR);
51 /**
52 * Destroys the quick search widget.
54 virtual ~QuickSearchWidget();
56 /**
57 * Returns the size hint of the quick search widget.
59 QSize sizeHint() const Q_DECL_OVERRIDE;
61 void updateQuickSearchText(const QString &text);
63 public Q_SLOTS:
64 void slotFocusQuickSearch();
66 Q_SIGNALS:
67 /**
68 * This signal is emitted whenever the user has changed
69 * the filter string in the line edit.
71 * @param filterString The new filter string.
73 void filterStringChanged(const QString &filterString);
75 /**
76 * This signal is emitted whenever the user pressed the
77 * arrow down key. In this case we set the focus on the
78 * item view that shows the contacts, so the user can
79 * navigate much faster.
81 void arrowDownKeyPressed();
83 private Q_SLOTS:
84 void resetTimer();
85 void delayedTextChanged();
87 protected:
88 void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
90 private:
91 QLineEdit *mEdit;
92 QTimer *mTimer;
95 #endif