diff --git a/src/widgets/resizingtextedit.cpp b/src/widgets/resizingtextedit.cpp index c4d2718f4..b08c57d9a 100644 --- a/src/widgets/resizingtextedit.cpp +++ b/src/widgets/resizingtextedit.cpp @@ -1,5 +1,8 @@ #include "widgets/resizingtextedit.hpp" +namespace chatterino { +namespace widgets { + ResizingTextEdit::ResizingTextEdit() { auto sizePolicy = this->sizePolicy(); @@ -30,6 +33,11 @@ int ResizingTextEdit::heightForWidth(int) const return margins.top() + document()->size().height() + margins.bottom() + 5; } +QFont &ResizingTextEdit::getFont() const +{ + return FontManager::getInstance().getFont(_font); +} + QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const { auto currentText = this->toPlainText(); @@ -161,3 +169,6 @@ QCompleter *ResizingTextEdit::getCompleter() const { return this->completer; } + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/resizingtextedit.hpp b/src/widgets/resizingtextedit.hpp index 59098b4ca..42847e50f 100644 --- a/src/widgets/resizingtextedit.hpp +++ b/src/widgets/resizingtextedit.hpp @@ -1,15 +1,23 @@ #pragma once +#include "fontmanager.hpp" + +#include #include #include #include #include +namespace chatterino { +namespace widgets { + class ResizingTextEdit : public QTextEdit { public: ResizingTextEdit(); + QFont &getFont() const; + QSize sizeHint() const override; bool hasHeightForWidth() const override; @@ -26,6 +34,8 @@ protected: private: QCompleter *completer = nullptr; + FontManager::Type _font = FontManager::Small; + // hadSpace is set to true in case the "textUnderCursor" word was after a space QString textUnderCursor(bool *hadSpace = nullptr) const; @@ -34,3 +44,6 @@ private: private slots: void insertCompletion(const QString &completion); }; + +} // namespace widgets +} // namespace chatterino