MCPcopy Create free account
hub / github.com/KDE/kate / scrollToBlock

Method scrollToBlock

apps/lib/diff/diffeditor.cpp:124–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124void DiffEditor::scrollToBlock(int block, bool flashBlock)
125{
126 if (flashBlock) {
127 if (m_timeLine.state() == QTimeLine::Running) {
128 m_timeLine.stop();
129 auto r = m_animateTextRect;
130 m_animateTextRect = QRect();
131 viewport()->update(r);
132 }
133 }
134 int lineNo = 0;
135 for (int i = 0; i < block; ++i) {
136 lineNo += document()->findBlockByNumber(i).lineCount();
137 }
138 verticalScrollBar()->setValue(lineNo);
139
140 if (flashBlock) {
141 QTextBlock b = document()->findBlockByNumber(block);
142 m_animateTextRect = blockBoundingGeometry(b).translated(contentOffset()).toRect();
143 m_timeLine.start();
144 }
145}
146
147void DiffEditor::resizeEvent(QResizeEvent *event)
148{

Callers 5

runGitDiffMethod · 0.80
jumpToNextFileMethod · 0.80
jumpToPrevFileMethod · 0.80
jumpToNextHunkMethod · 0.80
jumpToPrevHunkMethod · 0.80

Calls 4

stateMethod · 0.45
stopMethod · 0.45
updateMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected