void CppEditorBrowser::showHelp( const QString &w ) { QString word( w ); if ( word[ 0 ] == 'Q' ) { if ( word[ (int)word.length() - 1 ] == '&' || word[ (int)word.length() - 1 ] == '*' ) word.remove( word.length() - 1, 1 ); word = word.lower() + ".html"; QStringList lst; lst << "assistant" << "-file" << word; QProcess proc( lst ); proc.start(); return; } if ( word.find( '(' ) != -1 ) { QString txt = "::" + word.left( word.find( '(' ) ); QTextDocument *doc = curEditor->document(); QTextParagraph *p = doc->firstParagraph(); while ( p ) { if ( p->string()->toString().find( txt ) != -1 ) { curEditor->setCursorPosition( p->paragId(), 0 ); return; } p = p->next(); } } QMainWindow *mw = ::qt_cast<QMainWindow*>(curEditor->topLevelWidget()); if ( mw ) mw->statusBar()->message( tr( "Nothing available for '%1'" ).arg( w ), 1500 ); }
void EditorInterfaceImpl::scrollTo( const QString &txt, const QString & ) { if ( !viewManager || !viewManager->currentView() ) return; ( (CppEditor*)viewManager->currentView() )->sync(); QTextDocument *doc = ( (CppEditor*)viewManager->currentView() )->document(); QTextParagraph *p = doc->firstParagraph(); while ( p ) { if ( p->string()->toString().find( txt ) != -1 ) { ( (CppEditor*)viewManager->currentView() )->setCursorPosition( p->paragId() + 2, 0 ); break; } p = p->next(); } ( (CppEditor*)viewManager->currentView() )->setFocus(); }