From d4c3dac28f2afb7c8f675729ed91c56494928c43 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Thu, 9 Aug 2018 18:20:17 +0300 Subject: Remove the reserved space gap for the typing notifications --- src/TypingDisplay.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/TypingDisplay.cpp') diff --git a/src/TypingDisplay.cpp b/src/TypingDisplay.cpp index 08214a63..cd405a7a 100644 --- a/src/TypingDisplay.cpp +++ b/src/TypingDisplay.cpp @@ -1,5 +1,7 @@ +#include #include #include +#include #include "Config.h" #include "TypingDisplay.h" @@ -8,21 +10,33 @@ constexpr int LEFT_PADDING = 24; TypingDisplay::TypingDisplay(QWidget *parent) - : QWidget(parent) + : OverlayWidget(parent) + , offset_{conf::textInput::height} { QFont f; f.setPixelSize(conf::typingNotificationFontSize); - setFont(f); setFixedHeight(QFontMetrics(font()).height() + 2); + setAttribute(Qt::WA_TransparentForMouseEvents); +} + +void +TypingDisplay::setOffset(int margin) +{ + offset_ = margin; + move(0, parentWidget()->height() - offset_ - height()); } void TypingDisplay::setUsers(const QStringList &uid) { + move(0, parentWidget()->height() - offset_ - height()); + + text_.clear(); + if (uid.isEmpty()) { - text_.clear(); + hide(); update(); return; @@ -35,6 +49,7 @@ TypingDisplay::setUsers(const QStringList &uid) else if (uid.size() > 1) text_ += tr(" are typing"); + show(); update(); } -- cgit 1.5.1