connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
this, SLOT(rowsInserted(const QModelIndex &, int, int)));
connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex)));
connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
this, SLOT(rowsInserted(const QModelIndex &, int, int)));
connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex)));
#ifdef HAVE_WEBKIT
webPreview.timer.setSingleShot(true);
connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep()));
#ifdef HAVE_WEBKIT
webPreview.timer.setSingleShot(true);
connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep()));
- QGraphicsItem *item = itemAt(scenePos);
- return dynamic_cast<ChatItem *>(item);
+ ChatLine *line = qgraphicsitem_cast<ChatLine*>(itemAt(scenePos));
+ if(line)
+ return line->itemAt(line->mapFromScene(scenePos));
+ return 0;
qreal width = _sceneRect.width();
bool atBottom = (start == _lines.count());
bool atTop = !atBottom && (start == 0);
qreal width = _sceneRect.width();
bool atBottom = (start == _lines.count());
bool atTop = !atBottom && (start == 0);
void ChatScene::setHandleXLimits() {
_firstColHandle->setXLimits(0, _secondColHandle->sceneLeft());
_secondColHandle->setXLimits(_firstColHandle->sceneRight(), width() - minContentsWidth);
void ChatScene::setHandleXLimits() {
_firstColHandle->setXLimits(0, _secondColHandle->sceneLeft());
_secondColHandle->setXLimits(_firstColHandle->sceneRight(), width() - minContentsWidth);
// no item -> default scene actions
GraphicalUi::contextMenuActionProvider()->addActions(&menu, filter(), BufferId());
// no item -> default scene actions
GraphicalUi::contextMenuActionProvider()->addActions(&menu, filter(), BufferId());
- result += _lines[l]->item(ChatLineModel::SenderColumn).data(MessageModel::DisplayRole).toString() + " ";
- result += _lines[l]->item(ChatLineModel::ContentsColumn).data(MessageModel::DisplayRole).toString() + "\n";
+ result += _lines[l]->item(ChatLineModel::SenderColumn)->data(MessageModel::DisplayRole).toString() + " ";
+ result += _lines[l]->item(ChatLineModel::ContentsColumn)->data(MessageModel::DisplayRole).toString() + "\n";
- // This is somewhat hacky... we look at the contents item that is at the given y position, since
- // it has the full height. From this item, we can then determine the row index and hence the ChatLine.
- // ChatItems cover their ChatLine, so we won't get to the latter directly.
- ChatItem *contentItem = static_cast<ChatItem *>(itemAt(QPointF(_secondColHandle->sceneRight() + 1, y)));
- if(!contentItem) return -1;
- return contentItem->row();
+ QList<QGraphicsItem*> itemList = items(QPointF(0, y));
+
+ // ChatLine should be at the bottom of the list
+ for(int i = itemList.count()-1; i >= 0; i--) {
+ ChatLine *line = qgraphicsitem_cast<ChatLine *>(itemList.at(i));
+ if(line)
+ return line->row();
+ }
+ return -1;
// prepare to load a different URL
if(webPreview.previewItem) {
if(webPreview.previewItem->scene())
// prepare to load a different URL
if(webPreview.previewItem) {
if(webPreview.previewItem->scene())
qreal previewY = webPreview.urlRect.bottom();
qreal previewX = webPreview.urlRect.x();
if(previewY + webPreview.previewItem->boundingRect().height() > sceneRect().bottom())
qreal previewY = webPreview.urlRect.bottom();
qreal previewX = webPreview.urlRect.x();
if(previewY + webPreview.previewItem->boundingRect().height() > sceneRect().bottom())
case WebPreview::ShowPreview:
if(parentItem == 0 || webPreview.parentItem == parentItem) {
if(webPreview.previewItem && webPreview.previewItem->scene())
case WebPreview::ShowPreview:
if(parentItem == 0 || webPreview.parentItem == parentItem) {
if(webPreview.previewItem && webPreview.previewItem->scene())