File indexing completed on 2024-04-21 15:01:33

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Omat Holding B .V. <info@omat.nl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KFILTERPROXYSEARCHLINE_H
0008 #define KFILTERPROXYSEARCHLINE_H
0009 
0010 #include <kitemviews_export.h>
0011 
0012 #if KITEMVIEWS_ENABLE_DEPRECATED_SINCE(5, 50)
0013 
0014 #include <QWidget>
0015 #include <memory>
0016 
0017 class KFilterProxySearchLinePrivate;
0018 
0019 class QLineEdit;
0020 class QSortFilterProxyModel;
0021 
0022 /**
0023  * @class KFilterProxySearchLine kfilterproxysearchline.h KFilterProxySearchLine
0024  *
0025  * Responsible for the quick search when you are using a QSortFilterProxyModel.
0026  * This will give you an widget which you can embed in your application, call
0027  * the setProxy() function to indicate on which QSortFilterProxyModel this
0028  * search line should operate.
0029  *
0030  * @author Tom Albers <tomalbers@kde.nl>
0031  * @since 4.2
0032  * @deprecated since 5.50, use QLineEdit directly. If filtering is expensive,
0033  * consider a short timer to not act on every keypress, and if results are large,
0034  * consider not reacting until 3 letters.
0035  */
0036 
0037 class KITEMVIEWS_EXPORT KFilterProxySearchLine : public QWidget
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     /**
0043      * Constructor
0044      */
0045     KITEMVIEWS_DEPRECATED_VERSION(5, 50, "See class API docs")
0046     explicit KFilterProxySearchLine(QWidget *parent = nullptr);
0047 
0048     /**
0049      * Destructor
0050      */
0051     ~KFilterProxySearchLine() override;
0052 
0053     /**
0054      * Associate a proxy
0055      * @param proxy The proxy to operate with.
0056      */
0057     void setProxy(QSortFilterProxyModel *proxy);
0058 
0059     /**
0060      * To set the search to a text.
0061      */
0062     void setText(const QString &text);
0063 
0064     /**
0065      * Returns the pointer of the lineedit..
0066      */
0067     QLineEdit *lineEdit() const;
0068 
0069 private:
0070     std::unique_ptr<class KFilterProxySearchLinePrivate> const d;
0071 
0072     Q_DISABLE_COPY(KFilterProxySearchLine)
0073     Q_PRIVATE_SLOT(d, void slotSearchLineChange(const QString &newText))
0074     Q_PRIVATE_SLOT(d, void slotSearchLineActivate())
0075 };
0076 
0077 #endif
0078 
0079 #endif