| 122 | } |
| 123 | |
| 124 | void 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 | |
| 147 | void DiffEditor::resizeEvent(QResizeEvent *event) |
| 148 | { |
no test coverage detected