Making ChatItems in the first column full-height. Also fixes BR #272.
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Aug 2008 12:14:21 +0000 (14:14 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Aug 2008 12:14:21 +0000 (14:14 +0200)
src/qtui/chatitem.cpp
src/qtui/chatitem.h
src/qtui/chatline.cpp

index 7a11a66..036a6e6 100644 (file)
@@ -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;
index b0375d6..8de74d0 100644 (file)
@@ -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();
index 4e03f06..5213be8 100644 (file)
@@ -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);