File indexing completed on 2024-12-08 04:34:24

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QLineEdit>
0010 
0011 #include "libruqolawidgets_private_export.h"
0012 #include <chrono>
0013 using namespace std::chrono_literals;
0014 class QTimer;
0015 class LIBRUQOLAWIDGETS_TESTS_EXPORT SearchWithDelayLineEdit : public QLineEdit
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit SearchWithDelayLineEdit(QWidget *parent = nullptr);
0020     ~SearchWithDelayLineEdit() override;
0021 
0022     void setDelayMs(std::chrono::milliseconds value);
0023 
0024 Q_SIGNALS:
0025     void searchRequested(const QString &str);
0026     void searchCleared();
0027 
0028 private:
0029     LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchTimerFired();
0030     LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchTextEdited();
0031     QTimer *const mSearchTimer;
0032     std::chrono::milliseconds mMilliseconds = 1000ms;
0033 };