File indexing completed on 2024-12-22 04:28:10
0001 /* 0002 * SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "textcustomeditor_export.h" 0010 #include <QObject> 0011 #include <memory> 0012 class QCompleter; 0013 class QTextEdit; 0014 class QPlainTextEdit; 0015 0016 namespace TextCustomEditor 0017 { 0018 /** 0019 * @brief The TextEditorCompleter class 0020 * @author Laurent Montel <montel@kde.org> 0021 */ 0022 class TEXTCUSTOMEDITOR_EXPORT TextEditorCompleter : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit TextEditorCompleter(QTextEdit *editor, QObject *parent); 0027 explicit TextEditorCompleter(QPlainTextEdit *editor, QObject *parent); 0028 ~TextEditorCompleter() override; 0029 0030 void setCompleterStringList(const QStringList &list); 0031 0032 [[nodiscard]] QCompleter *completer() const; 0033 0034 void completeText(); 0035 0036 void setExcludeOfCharacters(const QString &excludes); 0037 0038 private: 0039 TEXTCUSTOMEDITOR_NO_EXPORT void slotCompletion(const QString &text); 0040 class TextEditorCompleterPrivate; 0041 std::unique_ptr<TextEditorCompleterPrivate> const d; 0042 }; 0043 }