本文整理汇总了C++中QTextDocument::firstParagraph方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextDocument::firstParagraph方法的具体用法?C++ QTextDocument::firstParagraph怎么用?C++ QTextDocument::firstParagraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextDocument
的用法示例。
在下文中一共展示了QTextDocument::firstParagraph方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showHelp
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 );
}
示例2: scrollTo
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();
}