File indexing completed on 2024-12-22 04:28:09

0001 /*
0002   SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "textautocorrectionwidgets_export.h"
0010 #include <QTextEdit>
0011 namespace TextAutoCorrectionCore
0012 {
0013 class AutoCorrection;
0014 }
0015 namespace TextAutoCorrectionWidgets
0016 {
0017 class AutoCorrectionTextEditPrivate;
0018 /**
0019  * @brief The AutoCorrectionTextEdit class
0020  * @author Laurent Montel <montel@kde.org>
0021  */
0022 class TEXTAUTOCORRECTIONWIDGETS_EXPORT AutoCorrectionTextEdit : public QTextEdit
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit AutoCorrectionTextEdit(QWidget *parent = nullptr);
0027     ~AutoCorrectionTextEdit() override;
0028 
0029     [[nodiscard]] TextAutoCorrectionCore::AutoCorrection *autocorrection() const;
0030 
0031     void setAutocorrection(TextAutoCorrectionCore::AutoCorrection *autocorrect);
0032 
0033     void setAutocorrectionLanguage(const QString &language);
0034 
0035 protected:
0036     void keyPressEvent(QKeyEvent *e) override;
0037 
0038 private:
0039     std::unique_ptr<AutoCorrectionTextEditPrivate> const d;
0040 };
0041 }