MCPcopy Create free account
hub / github.com/KDE/kdiff3 / mouseDoubleClickEvent

Method mouseDoubleClickEvent

src/difftextwindow.cpp:716–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714}
715
716void DiffTextWindow::mouseDoubleClickEvent(QMouseEvent* e)
717{
718 qCInfo(kdiffDiffTextWindow) << "Mouse Double Clicked";
719 qCDebug(kdiffDiffTextWindow) << "d->m_lastKnownMousePos = " << d->m_lastKnownMousePos << ", e->pos() = " << e->pos();
720 qCDebug(kdiffDiffTextWindow) << "d->m_bSelectionInProgress = " << d->m_bSelectionInProgress;
721
722 d->m_bSelectionInProgress = false;
723 d->m_lastKnownMousePos = e->pos();
724 if(e->button() == Qt::LeftButton)
725 {
726 LineRef line;
727 qint32 pos;
728 convertToLinePos(e->pos().x(), e->pos().y(), line, pos);
729 qCInfo(kdiffDiffTextWindow) << "Left Button detected,";
730 qCDebug(kdiffDiffTextWindow) << "line = " << line << ", pos = " << pos;
731
732 // Get the string data of the current line
733 QString s;
734 if(d->m_bWordWrap)
735 {
736 if(!line.isValid() || (size_t)line >= d->m_diff3WrapLineVector.size())
737 return;
738 const Diff3WrapLine& d3wl = d->m_diff3WrapLineVector[line];
739 s = d->getString(d3wl.diff3LineIndex).mid(d3wl.wrapLineOffset, d3wl.wrapLineLength);
740 }
741 else
742 {
743 if(!line.isValid() || (size_t)line >= d->getDiff3LineVector()->size())
744 return;
745 s = d->getString(line);
746 }
747
748 if(!s.isEmpty())
749 {
750 const bool selectionWasEmpty = d->m_selection.isEmpty();
751 qsizetype pos1, pos2;
752 Utils::calcTokenPos(s, pos, pos1, pos2);
753
754 resetSelection();
755 d->m_selection.start(line, pos1);
756 d->m_selection.end(line, pos2);
757 if(!d->m_selection.isEmpty() && selectionWasEmpty)
758 Q_EMIT newSelection();
759
760 update();
761 // Q_EMIT d->m_selectionEnd() happens in the mouseReleaseEvent.
762 showStatusLine(line);
763 }
764 }
765}
766
767void DiffTextWindow::mouseReleaseEvent(QMouseEvent* e)
768{

Callers

nothing calls this directly

Calls 7

startMethod · 0.80
endMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45
getStringMethod · 0.45
getDiff3LineVectorMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected