File indexing completed on 2024-04-28 04:42:45

0001 /*
0002     SPDX-FileCopyrightText: 2008 Laurent Montel <montel@kde.org>
0003     SPDX-FileCopyrightText: 2008 Benjamin C. Meyer <ben@meyerhome.net>
0004     SPDX-FileCopyrightText: 2008 Urs Wolfer <uwolfer@kde.org>
0005     SPDX-FileCopyrightText: 2009 Dawit Alemayehu <adawit@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef SEARCHBAR_P_H
0011 #define SEARCHBAR_P_H
0012 
0013 #include <QWidget>
0014 
0015 #include "ui_searchbar.h"
0016 
0017 class QEvent;
0018 
0019 /**
0020  * This is the widget that shows up when the search is initiated.
0021  */
0022 class SearchBar : public QWidget
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit SearchBar(QWidget *parent = nullptr);
0028     ~SearchBar() override;
0029 
0030     QString searchText() const;
0031     bool caseSensitive() const;
0032     bool highlightMatches() const;
0033     void setFoundMatch(bool match);
0034     void setSearchText(const QString&);
0035 
0036     bool event(QEvent* e) override;
0037 
0038 public Q_SLOTS:
0039     void setVisible(bool visible) override;
0040     void clear();
0041     void findNext();
0042     void findPrevious();
0043     void textChanged(const QString&);
0044 
0045 Q_SIGNALS:
0046     void searchTextChanged(const QString& text, bool backward = false);
0047 
0048 private:
0049     Ui::SearchBar m_ui;
0050     QPointer<QWidget> m_focusWidget;
0051 };
0052 
0053 #endif // SEARCHBAR_P_H