From: Manuel Nickschas Date: Mon, 11 Aug 2008 19:20:41 +0000 (+0200) Subject: Do no longer react to right mouse button presses X-Git-Tag: 0.3.0~56 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=298137f6626526961b6644cc1eb8b0ae3d60ae8d Do no longer react to right mouse button presses --- diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 14fd3add..655d1fd3 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -204,7 +204,7 @@ void ChatItem::continueSelecting(const QPointF &pos) { } void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { - if(event->buttons() & Qt::LeftButton) { + if(event->buttons() == Qt::LeftButton) { if(_selectionMode == NoSelection) { chatScene()->setSelectingItem(this); // removes earlier selection if exists _selectionStart = _selectionEnd = posToCursor(event->pos()); @@ -221,20 +221,25 @@ void ChatItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { } void ChatItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - if(contains(event->pos())) { - qint16 end = posToCursor(event->pos()); - if(end != _selectionEnd) { - _selectionEnd = end; - update(); + if(event->buttons() == Qt::LeftButton) { + if(contains(event->pos())) { + qint16 end = posToCursor(event->pos()); + if(end != _selectionEnd) { + _selectionEnd = end; + update(); + } + } else { + setFullSelection(); + chatScene()->startGlobalSelection(this, event->pos()); } + event->accept(); } else { - setFullSelection(); - chatScene()->startGlobalSelection(this, event->pos()); + event->ignore(); } } void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - if(_selectionMode != NoSelection) { + if(_selectionMode != NoSelection && event->buttons() == Qt::LeftButton) { _selectionEnd = posToCursor(event->pos()); QString selection = data(MessageModel::DisplayRole).toString().mid(qMin(_selectionStart, _selectionEnd), qAbs(_selectionStart - _selectionEnd)); @@ -266,17 +271,17 @@ void ChatItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { void ChatItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { //qDebug() << (void*)this << "entering"; - + event->ignore(); } void ChatItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { //qDebug() << (void*)this << "leaving"; - + event->ignore(); } void ChatItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { //qDebug() << (void*)this << event->pos(); - + event->ignore(); } diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 8bf8adde..1af7e850 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -233,7 +233,7 @@ void ChatScene::updateSelection(const QPointF &pos) { } void ChatScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - if(_isSelecting && event->buttons() & Qt::LeftButton) { + if(_isSelecting && event->buttons() == Qt::LeftButton) { updateSelection(event->scenePos()); event->accept(); } else { @@ -242,7 +242,7 @@ void ChatScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { } void ChatScene::mousePressEvent(QGraphicsSceneMouseEvent *event) { - if(event->buttons() & Qt::LeftButton && _selectionStart >= 0) { + if(event->buttons() == Qt::LeftButton && _selectionStart >= 0) { for(int l = qMin(_selectionStart, _selectionEnd); l <= qMax(_selectionStart, _selectionEnd); l++) { _lines[l]->setSelected(false); } @@ -254,7 +254,7 @@ void ChatScene::mousePressEvent(QGraphicsSceneMouseEvent *event) { } void ChatScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - if(_isSelecting) { + if(_isSelecting && event->buttons() == Qt::LeftButton) { # ifdef Q_WS_X11 QApplication::clipboard()->setText(selectionToString(), QClipboard::Selection); # endif