summary refs log tree commit diff
path: root/src/TypingDisplay.cpp
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-08-09 18:20:17 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-08-09 18:20:17 +0300
commitd4c3dac28f2afb7c8f675729ed91c56494928c43 (patch)
tree234fa17a819dfcc11b1e3bb9e61e603879f71d63 /src/TypingDisplay.cpp
parentAllow user to configure join rules for a room (diff)
downloadnheko-d4c3dac28f2afb7c8f675729ed91c56494928c43.tar.xz
Remove the reserved space gap for the typing notifications
Diffstat (limited to 'src/TypingDisplay.cpp')
-rw-r--r--src/TypingDisplay.cpp21
1 files changed, 18 insertions, 3 deletions
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 <QDebug> #include <QPainter> #include <QPoint> +#include <QShowEvent> #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(); }