#pragma once #include "lts_widgets_export.h" #include #include namespace Ui { class LtsTextEditor; } class QTextEdit; class QTextCharFormat; namespace LtsWidgets { class LTSWIDGETS_EXPORT LtsTextEditor : public QWidget { Q_OBJECT public: LtsTextEditor(QWidget* parent = nullptr); ~LtsTextEditor(); void enableBackgroundColor(bool onOff); void setInitialBackgroundColor(const QColor& bgColor); QTextEdit* textEdit(); QColor backgroundColor() const; Q_SIGNALS: void backgroundColorChanged(const QColor& bgColor); private: Ui::LtsTextEditor* m_ui; QColor m_backgroundColor{Qt::white}; QColor m_foregroundColor{Qt::black}; private slots: void slotCurrentCharFormatChanged(const QTextCharFormat& format); void slotFontChanged(const QFont& f); void slotTextColorChanged(const QColor& c); void slotBackgroundColorChanged(const QColor& bgColor); void slotAlignmentChanged(); void slotMergeFormatOnWordOrSelection(const QTextCharFormat& format); void slotClipboardDataChanged(); void slotTextColor(); void slotBackgroundColor(); void slotTextSize(const QString& p); void slotTextSizeEditingFinished(); void slotTextFamily(const QString& f); void slotTextItalic(); void slotTextUnderline(); void slotTextBold(); void slotTextAlign(); }; } // namespace LtsWidgets