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

Method mouseDoubleClickEvent

src/mergeresultwindow.cpp:1812–1842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1810}
1811
1812void MergeResultWindow::mouseDoubleClickEvent(QMouseEvent* e)
1813{
1814 if(e->button() == Qt::LeftButton)
1815 {
1816 const LineRef line = convertToLine(e->pos().y());
1817 const QString s = getString(line);
1818 QTextLayout textLayout(s, font(), this);
1819 getTextLayoutForLine(line, s, textLayout);
1820 qint32 pos = textLayout.lineAt(0).xToCursor(e->pos().x() - textLayout.position().x());
1821 m_cursorXPos = pos;
1822 m_cursorOldXPixelPos = m_cursorXPixelPos;
1823 m_cursorYPos = line;
1824
1825 if(!s.isEmpty())
1826 {
1827 const bool selectionWasEmpty = m_selection.isEmpty();
1828 qsizetype pos1, pos2;
1829
1830 Utils::calcTokenPos(s, pos, pos1, pos2);
1831
1832 resetSelection();
1833 m_selection.start(line, pos1);
1834 m_selection.end(line, pos2);
1835 if(!m_selection.isEmpty() && selectionWasEmpty)
1836 Q_EMIT newSelection();
1837
1838 update();
1839 // Q_EMIT selectionEnd() happens in the mouseReleaseEvent.
1840 }
1841 }
1842}
1843
1844void MergeResultWindow::mouseReleaseEvent(QMouseEvent* e)
1845{

Callers

nothing calls this directly

Calls 4

getStringFunction · 0.85
startMethod · 0.80
endMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected