Manual implement column handle movement to be able to restrict it to horizontal movin...
[quassel.git] / src / qtui / chatscene.cpp
index d7ad76a..6eb07a9 100644 (file)
@@ -28,6 +28,8 @@
 #include "columnhandleitem.h"
 #include "qtui.h"
 
+const qreal minContentsWidth = 200;
+
 ChatScene::ChatScene(QAbstractItemModel *model, QObject *parent) : QGraphicsScene(parent), _model(model) {
   _width = 0;
   connect(this, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(rectChanged(const QRectF &)));
@@ -46,7 +48,9 @@ ChatScene::ChatScene(QAbstractItemModel *model, QObject *parent) : QGraphicsScen
   secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator()); addItem(secondColHandle);
 
   firstColHandle->setXPos(firstColHandlePos);
+  firstColHandle->setXLimits(0, secondColHandlePos);
   secondColHandle->setXPos(secondColHandlePos);
+  secondColHandle->setXLimits(firstColHandlePos, width() - minContentsWidth);
 
   emit heightChanged(height());
 }
@@ -91,6 +95,7 @@ void ChatScene::setWidth(qreal w) {
     _height += line->setGeometry(_width, firstColHandlePos, secondColHandlePos);
   }
   setSceneRect(QRectF(0, 0, w, _height));
+  secondColHandle->setXLimits(firstColHandlePos, width() - minContentsWidth);
   emit heightChanged(_height);
 }
 
@@ -98,15 +103,3 @@ void ChatScene::rectChanged(const QRectF &rect) {
   firstColHandle->sceneRectChanged(rect);
   secondColHandle->sceneRectChanged(rect);
 }
-
-void ChatScene::mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ) {
-  /*
-  qDebug() << "recv" << mouseEvent->scenePos();
-  ChatLine *line = static_cast<ChatLine*>(itemAt(mouseEvent->scenePos()));
-  ChatItem *item = static_cast<ChatItem*>(itemAt(mouseEvent->scenePos()));
-  qDebug() << (void*)line << (void*)item;
-  if(line) {
-    line->myMousePressEvent(mouseEvent);
-  } else  QGraphicsScene::mousePressEvent(mouseEvent);
-  */
-}