fixed splits not redrawing after font changed
This commit is contained in:
+3
-1
@@ -10,11 +10,13 @@ FontManager::FontManager()
|
||||
, currentFont(this->currentFontFamily.getValue().c_str(), currentFontSize.getValue())
|
||||
{
|
||||
this->currentFontFamily.getValueChangedSignal().connect([this](const std::string &newValue) {
|
||||
this->incGeneration();
|
||||
this->currentFont.setFamily(newValue.c_str()); //
|
||||
this->fontChanged.invoke();
|
||||
});
|
||||
this->currentFontSize.getValueChangedSignal().connect([this](const int &newValue) {
|
||||
this->currentFont.setSize(newValue); //
|
||||
this->incGeneration();
|
||||
this->currentFont.setSize(newValue);
|
||||
this->fontChanged.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -68,9 +68,11 @@ bool MessageRef::layout(int width, float dpiMultiplyer)
|
||||
// update word sizes if needed
|
||||
if (imagesChanged) {
|
||||
this->updateImageSizes();
|
||||
this->buffer = nullptr;
|
||||
}
|
||||
if (textChanged) {
|
||||
this->updateTextSizes();
|
||||
this->buffer = nullptr;
|
||||
}
|
||||
if (widthChanged || wordMaskChanged) {
|
||||
this->buffer = nullptr;
|
||||
|
||||
@@ -61,6 +61,10 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||
this->goToBottom->getLabel().setText("Jump to bottom");
|
||||
this->goToBottom->setVisible(false);
|
||||
|
||||
this->fontChangedConnection = FontManager::getInstance().fontChanged.connect([this] {
|
||||
this->layoutMessages(); //
|
||||
});
|
||||
|
||||
connect(goToBottom, &RippleEffectLabel::clicked, this,
|
||||
[this] { QTimer::singleShot(180, [this] { this->scrollBar.scrollToBottom(); }); });
|
||||
|
||||
@@ -79,6 +83,7 @@ ChannelView::~ChannelView()
|
||||
{
|
||||
QObject::disconnect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged,
|
||||
this, &ChannelView::wordTypeMaskChanged);
|
||||
FontManager::getInstance().fontChanged.disconnect(this->fontChangedConnection);
|
||||
}
|
||||
|
||||
void ChannelView::queueUpdate()
|
||||
@@ -241,8 +246,9 @@ QString ChannelView::getSelectedText()
|
||||
|
||||
if (first) {
|
||||
first = false;
|
||||
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
||||
part.getCharacterLength();
|
||||
bool isSingleWord =
|
||||
isSingleMessage &&
|
||||
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
||||
|
||||
if (isSingleWord) {
|
||||
// return single word
|
||||
@@ -519,9 +525,10 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
||||
// this->selectionMax.messageIndex >= messageIndex) {
|
||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||
//} else {
|
||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
||||
? this->colorScheme.ChatBackgroundHighlighted
|
||||
: this->colorScheme.ChatBackground);
|
||||
painter.fillRect(buffer->rect(),
|
||||
(messageRef->getMessage()->getCanHighlightTab())
|
||||
? this->colorScheme.ChatBackgroundHighlighted
|
||||
: this->colorScheme.ChatBackground);
|
||||
//}
|
||||
|
||||
// draw selection
|
||||
|
||||
@@ -163,6 +163,8 @@ private:
|
||||
boost::signals2::connection repaintGifsConnection;
|
||||
boost::signals2::connection layoutConnection;
|
||||
|
||||
pajlada::Signals::NoArgSignal::Connection fontChangedConnection;
|
||||
|
||||
private slots:
|
||||
void wordTypeMaskChanged()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user