| 300 | } |
| 301 | |
| 302 | void 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 | |
| 322 | void InputEditorView::updateMenu() |
| 323 | { |