Remove the reserved space gap for the typing notifications

This commit is contained in:
Konstantinos Sideris 2018-08-09 18:20:17 +03:00
parent aec5587947
commit d4c3dac28f
6 changed files with 44 additions and 19 deletions

View file

@ -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();
}