void PythonScriptViewWidget::scrollToEditorLine(const QUrl & link) { QStringList strList = link.toString().split(":"); QString file = strList.at(0); int line = strList.at(1).toInt()-1; if (file == "<unnamed script>") { tabWidget->setCurrentIndex(0); scrollToLine(getCurrentMainScriptEditor(), line); return; } for (int i = 0 ; i < mainScriptsTabWidget->count() ; ++i) { PythonCodeEditor *codeEditor = getMainScriptEditor(i); if (file == codeEditor->getFileName()) { tabWidget->setCurrentIndex(0); mainScriptsTabWidget->setCurrentIndex(i); scrollToLine(codeEditor, line); return; } } for (int i = 0 ; i < modulesTabWidget->count() ; ++i) { PythonCodeEditor *codeEditor = getModuleEditor(i); if (file == codeEditor->getFileName()) { tabWidget->setCurrentIndex(1); modulesTabWidget->setCurrentIndex(i); scrollToLine(codeEditor, line); return; } } for (int i = 0 ; i < pluginsTabWidget->count() ; ++i) { PythonCodeEditor *codeEditor = getPluginEditor(i); if (file == codeEditor->getFileName()) { tabWidget->setCurrentIndex(3); pluginsTabWidget->setCurrentIndex(i); scrollToLine(codeEditor, line); return; } } }
void CodeEditorComponent::loadContent (const String& newContent) { clearCachedIterators (0); document.replaceAllContent (newContent); document.clearUndoHistory(); document.setSavePoint(); caretPos.setPosition (0); selectionStart.setPosition (0); selectionEnd.setPosition (0); scrollToLine (0); }
void ChatLog::onWorkerTimeout() { // Fairly arbitrary but // large values will make the UI unresponsive const int stepSize = 50; layout(workerLastIndex, workerLastIndex+stepSize, useableWidth()); workerLastIndex += stepSize; // done? if (workerLastIndex >= lines.size()) { workerTimer->stop(); // switch back to the scene containing the chat messages setScene(scene); // make sure everything gets updated updateSceneRect(); checkVisibility(); updateTypingNotification(); updateMultiSelectionRect(); // scroll if (workerStb) scrollToBottom(); else scrollToLine(workerAnchorLine); // don't keep a Ptr to the anchor line workerAnchorLine = ChatLine::Ptr(); // hidden during busy screen verticalScrollBar()->show(); } }
void CodeEditorComponent::scrollBy (int deltaLines) { scrollToLine (firstLineOnScreen + deltaLines); }