#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 &)));
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());
}
_height += line->setGeometry(_width, firstColHandlePos, secondColHandlePos);
}
setSceneRect(QRectF(0, 0, w, _height));
+ secondColHandle->setXLimits(firstColHandlePos, width() - minContentsWidth);
emit heightChanged(_height);
}
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);
- */
-}