From 5cb0dfcd0cb0d5ee49fc4ca0de6c0116134326a7 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 13 Aug 2008 14:14:21 +0200 Subject: [PATCH] Making ChatItems in the first column full-height. Also fixes BR #272. --- src/qtui/chatitem.cpp | 4 ++-- src/qtui/chatitem.h | 2 +- src/qtui/chatline.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 7a11a665..036a6e62 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -60,11 +60,11 @@ QVariant ChatItem::data(int role) const { return model()->data(index, role); } -qreal ChatItem::setWidth(qreal w) { +qreal ChatItem::setGeometry(qreal w, qreal h) { if(w == _boundingRect.width()) return _boundingRect.height(); prepareGeometryChange(); _boundingRect.setWidth(w); - qreal h = computeHeight(); + if(h < 0) h = computeHeight(); _boundingRect.setHeight(h); if(haveLayout()) updateLayout(); return h; diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index b0375d6c..8de74d0e 100644 --- a/src/qtui/chatitem.h +++ b/src/qtui/chatitem.h @@ -55,7 +55,7 @@ class ChatItem : public QGraphicsItem { virtual QVariant data(int role) const; // returns height - qreal setWidth(qreal width); + qreal setGeometry(qreal width, qreal height = -1); // selection stuff, to be called by the scene void clearSelection(); diff --git a/src/qtui/chatline.cpp b/src/qtui/chatline.cpp index 4e03f064..5213be8a 100644 --- a/src/qtui/chatline.cpp +++ b/src/qtui/chatline.cpp @@ -71,9 +71,9 @@ qreal ChatLine::setGeometry(qreal width, qreal firstHandlePos, qreal secondHandl qreal firstsep = QtUi::style()->firstColumnSeparator()/2; qreal secondsep = QtUi::style()->secondColumnSeparator()/2; - _timestampItem.setWidth(firstHandlePos - firstsep); - _senderItem.setWidth(secondHandlePos - firstHandlePos - (firstsep+secondsep)); - _height = _contentsItem.setWidth(width - secondHandlePos - secondsep); + _height = _contentsItem.setGeometry(width - secondHandlePos - secondsep); + _timestampItem.setGeometry(firstHandlePos - firstsep, _height); + _senderItem.setGeometry(secondHandlePos - firstHandlePos - (firstsep+secondsep), _height); _senderItem.setPos(firstHandlePos + firstsep, 0); _contentsItem.setPos(secondHandlePos + secondsep, 0); -- 2.20.1