1 | /* |
2 | * Copyright (C) 2007-2008 Omat Holding B.V. <info@omat.nl> |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | * Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KFILTERPROXYSEARCHLINE_H |
21 | #define KFILTERPROXYSEARCHLINE_H |
22 | |
23 | #include <kdeui_export.h> |
24 | |
25 | #include <QtGui/QWidget> |
26 | |
27 | class KLineEdit; |
28 | class QSortFilterProxyModel; |
29 | |
30 | /** |
31 | * @class KFilterProxySearchLine |
32 | * |
33 | * Responsible for the quick search when you are using a QSortFilterProxyModel. |
34 | * This will give you an widget which you can embed in your application, call |
35 | * the setProxy() function to indicate on which QSortFilterProxyModel this |
36 | * search line should operate. |
37 | * |
38 | * @author Tom Albers <tomalbers@kde.nl> |
39 | * @since 4.2 |
40 | */ |
41 | |
42 | class KDEUI_EXPORT KFilterProxySearchLine |
43 | : public QWidget |
44 | { |
45 | Q_OBJECT |
46 | |
47 | public: |
48 | /** |
49 | * Constructor |
50 | */ |
51 | explicit KFilterProxySearchLine( QWidget* parent = 0 ); |
52 | |
53 | /** |
54 | * Destructor |
55 | */ |
56 | ~KFilterProxySearchLine(); |
57 | |
58 | /** |
59 | * Associate a proxy |
60 | * @param proxy The proxy to operate with. |
61 | */ |
62 | void setProxy( QSortFilterProxyModel* proxy ); |
63 | |
64 | /** |
65 | * To set the search to a text. |
66 | */ |
67 | void setText( const QString& text ); |
68 | |
69 | /** |
70 | * Returns the pointer of the lineedit.. |
71 | */ |
72 | KLineEdit* lineEdit() const; |
73 | |
74 | private: |
75 | class Private; |
76 | Private* const d; |
77 | Q_DISABLE_COPY( KFilterProxySearchLine ) |
78 | Q_PRIVATE_SLOT( d, void slotSearchLineChange( const QString& newText ) ) |
79 | Q_PRIVATE_SLOT( d, void slotSearchLineActivate() ) |
80 | }; |
81 | |
82 | #endif |
83 | |