From 91dda9483b150e9f2465030e587216558859be18 Mon Sep 17 00:00:00 2001 From: CLouDY Date: Mon, 28 Aug 2017 21:48:30 +0100 Subject: [PATCH] (WIP) Use configured font for text input in ChatWidgetInput Needs work - Doesn't currently change in same fashion as ChatWidget, changes are only apparent when you initialise or reintialise the object (e.g. when you close and open a new chat window). Just need to do some more investigation into how this is handled by other widgets. --- src/widgets/chatwidgetinput.cpp | 7 +++++++ src/widgets/chatwidgetinput.hpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/widgets/chatwidgetinput.cpp b/src/widgets/chatwidgetinput.cpp index 075e7f3d3..cb68b7e31 100644 --- a/src/widgets/chatwidgetinput.cpp +++ b/src/widgets/chatwidgetinput.cpp @@ -7,6 +7,7 @@ #include "notebookpage.hpp" #include "settingsmanager.hpp" +#include #include #include #include @@ -165,6 +166,11 @@ ChatWidgetInput::~ChatWidgetInput() */ } +QFont &ChatWidgetInput::getFont() const +{ + return FontManager::getInstance().getFont(_font); +} + void ChatWidgetInput::refreshTheme() { QPalette palette; @@ -174,6 +180,7 @@ void ChatWidgetInput::refreshTheme() this->textLengthLabel.setPalette(palette); this->textInput.setStyleSheet(this->colorScheme.InputStyleSheet); + this->textInput.setFont(this->getFont()); } void ChatWidgetInput::editTextChanged() diff --git a/src/widgets/chatwidgetinput.hpp b/src/widgets/chatwidgetinput.hpp index a0fdc09bf..76be1f50f 100644 --- a/src/widgets/chatwidgetinput.hpp +++ b/src/widgets/chatwidgetinput.hpp @@ -1,9 +1,11 @@ #pragma once +#include "fontmanager.hpp" #include "resizingtextedit.hpp" #include "widgets/basewidget.hpp" #include "widgets/chatwidgetheaderbutton.hpp" +#include #include #include #include @@ -40,6 +42,8 @@ private: ResizingTextEdit textInput; QLabel textLengthLabel; ChatWidgetHeaderButton emotesLabel; + FontManager::Type _font = FontManager::Small; + QFont &getFont() const; QStringList prevMsg; unsigned int prevIndex = 0; virtual void refreshTheme() override;