MCPcopy Create free account
hub / github.com/KDAB/GammaRay / blockAtPosition

Method blockAtPosition

ui/codeeditor/codeeditor.cpp:255–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255QTextBlock CodeEditor::blockAtPosition(int y) const
256{
257 auto block = firstVisibleBlock();
258 if (!block.isValid())
259 return QTextBlock();
260
261 int top = blockBoundingGeometry(block).translated(contentOffset()).top();
262 int bottom = top + blockBoundingRect(block).height();
263 do {
264 if (top <= y && y <= bottom) {
265 return block;
266 }
267 block = block.next();
268 top = bottom;
269 bottom = top + blockBoundingRect(block).height();
270 } while (block.isValid());
271 return QTextBlock();
272}
273
274bool CodeEditor::isFoldable(const QTextBlock &block) const
275{

Callers 1

mouseReleaseEventMethod · 0.80

Calls 2

QTextBlockClass · 0.85
isValidMethod · 0.45

Tested by

no test coverage detected