MCPcopy Create free account
hub / github.com/clementgallet/libTAS / scrollToFrame

Method scrollToFrame

src/program/ui/InputEditorView.cpp:302–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void InputEditorView::scrollToFrame(unsigned long long frame)
303{
304 int toprow = verticalScrollBar()->value();
305 int bottomrow = toprow + verticalScrollBar()->pageStep();
306
307 /* Place the current frame at about a quarter of the visible frames */
308 int visibleFrames = bottomrow - toprow;
309 int firstVisibleFrame = frame - 1 - visibleFrames/4;
310 if (firstVisibleFrame < 0) firstVisibleFrame = 0;
311
312 /* Get the first visible column */
313 int leftcol = columnAt(rect().left());
314
315 /* Scrolling triggers the signal to our manualScroll() slot, which
316 * we don't want, so we disable the connection */
317 disconnect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &InputEditorView::manualScroll);
318 scrollTo(inputEditorModel->index(firstVisibleFrame, leftcol), QAbstractItemView::PositionAtTop);
319 connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &InputEditorView::manualScroll);
320}
321
322void InputEditorView::updateMenu()
323{

Callers

nothing calls this directly

Calls 2

valueMethod · 0.80
indexMethod · 0.80

Tested by

no test coverage detected