File indexing completed on 2024-12-22 04:28:13
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "textcustomeditor_export.h" 0010 0011 #include <QWidget> 0012 0013 namespace TextCustomEditor 0014 { 0015 class RichTextEditor; 0016 class RichTextEditorWidgetPrivate; 0017 /** 0018 * @brief The RichTextEditorWidget class 0019 * @author Laurent Montel <montel@kde.org> 0020 */ 0021 class TEXTCUSTOMEDITOR_EXPORT RichTextEditorWidget : public QWidget 0022 { 0023 Q_OBJECT 0024 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) 0025 public: 0026 explicit RichTextEditorWidget(QWidget *parent = nullptr); 0027 explicit RichTextEditorWidget(RichTextEditor *customEditor, QWidget *parent = nullptr); 0028 ~RichTextEditorWidget() override; 0029 0030 void clear(); 0031 0032 [[nodiscard]] RichTextEditor *editor() const; 0033 0034 void setReadOnly(bool readOnly); 0035 bool isReadOnly() const; 0036 0037 void setHtml(const QString &html); 0038 [[nodiscard]] QString toHtml() const; 0039 0040 void setPlainText(const QString &text); 0041 [[nodiscard]] QString toPlainText() const; 0042 0043 void setAcceptRichText(bool b); 0044 bool acceptRichText() const; 0045 0046 void setSpellCheckingConfigFileName(const QString &_fileName); 0047 0048 [[nodiscard]] bool isEmpty() const; 0049 public Q_SLOTS: 0050 void slotFindNext(); 0051 void slotFind(); 0052 void slotReplace(); 0053 0054 private: 0055 TEXTCUSTOMEDITOR_NO_EXPORT void slotHideFindBar(); 0056 TEXTCUSTOMEDITOR_NO_EXPORT void init(RichTextEditor *customEditor = nullptr); 0057 std::unique_ptr<RichTextEditorWidgetPrivate> const d; 0058 }; 0059 }