summary refs log tree commit diff
path: root/src/RoomInfoListItem.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-19 18:10:48 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-19 18:10:48 +0200
commitcef385e1e49193fe42eaedaa5fc22ae0002b8dd1 (patch)
tree44890f6c86fdc74de5e0591fd7396452098448c6 /src/RoomInfoListItem.cc
parentDark theme revisited (diff)
downloadnheko-cef385e1e49193fe42eaedaa5fc22ae0002b8dd1.tar.xz
Use the full with of the roomlist for the last message
Diffstat (limited to '')
-rw-r--r--src/RoomInfoListItem.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/RoomInfoListItem.cc b/src/RoomInfoListItem.cc
index b504bdd7..3a422787 100644
--- a/src/RoomInfoListItem.cc
+++ b/src/RoomInfoListItem.cc
@@ -167,9 +167,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
                 p.setFont(headingFont_);
                 p.setPen(titlePen);
 
-                const auto msgStampWidth =
+                const int msgStampWidth =
                   QFontMetrics(timestampFont_).width(lastMsgInfo_.timestamp) + 4;
 
+                // We use the full width of the widget if there is no unread msg bubble.
+                const int bottomLineWidthLimit = (unreadMsgCount_ > 0) ? msgStampWidth : 0;
+
                 // Name line.
                 QFontMetrics fontNameMetrics(headingFont_);
                 int top_y = 2 * Padding + fontNameMetrics.ascent() / 2;
@@ -201,7 +204,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
                         // The limit is the space between the end of the username and the start of
                         // the timestamp.
                         int descriptionLimit = std::max(
-                          0, width() - 3 * Padding - msgStampWidth - IconSize - nameWidth - 5);
+                          0,
+                          width() - 3 * Padding - bottomLineWidthLimit - IconSize - nameWidth - 5);
                         auto description =
                           metrics.elidedText(lastMsgInfo_.body, Qt::ElideRight, descriptionLimit);
                         p.drawText(QPoint(2 * Padding + IconSize + nameWidth, bottom_y),