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

Method mousePressEvent

src/difftextwindow.cpp:683–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681}
682
683void DiffTextWindow::mousePressEvent(QMouseEvent* e)
684{
685 qCInfo(kdiffDiffTextWindow) << "mousePressEvent triggered";
686 if(e->button() == Qt::LeftButton)
687 {
688 LineRef line;
689 qint32 pos;
690 convertToLinePos(e->pos().x(), e->pos().y(), line, pos);
691 qCInfo(kdiffDiffTextWindow) << "Left Button detected,";
692 qCDebug(kdiffDiffTextWindow) << "line = " << line << ", pos = " << pos;
693
694 //TODO: Fix after line number area is converted to a QWidget.
695 qint32 fontWidth = fontMetrics().horizontalAdvance('0');
696 qint32 xOffset = d->leftInfoWidth() * fontWidth;
697
698 if((!gOptions->m_bRightToLeftLanguage && e->pos().x() < xOffset) || (gOptions->m_bRightToLeftLanguage && e->pos().x() > width() - xOffset))
699 {
700 Q_EMIT setFastSelectorLine(convertLineToDiff3LineIdx(line));
701 d->m_selection.reset(); // Disable current d->m_selection
702 }
703 else
704 { // Selection
705 resetSelection();
706 d->m_selection.start(line, pos);
707 d->m_selection.end(line, pos);
708 d->m_bSelectionInProgress = true;
709 d->m_lastKnownMousePos = e->pos();
710
711 showStatusLine(line);
712 }
713 }
714}
715
716void DiffTextWindow::mouseDoubleClickEvent(QMouseEvent* e)
717{

Callers

nothing calls this directly

Calls 7

leftInfoWidthMethod · 0.80
startMethod · 0.80
endMethod · 0.80
isFromBufferMethod · 0.80
resetMethod · 0.45
isEmptyMethod · 0.45
getEncodingMethod · 0.45

Tested by

no test coverage detected