本文整理汇总了C++中QTextEdit::find方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::find方法的具体用法?C++ QTextEdit::find怎么用?C++ QTextEdit::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
bool QTextEditProto::find(const QString &exp, int options)
{
QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
if (item)
return item->find(exp, (QTextDocument::FindFlag)options);
return false;
}
示例2: onClickedSearchNext
void SourceViewer::onClickedSearchNext()
{
QTextEdit *logTextEdit = getCurrentSourceEdit();
if(logTextEdit != NULL)
{
QTextDocument::FindFlags flags = 0x0;
if(ui.caseSensitiveCheck->isChecked())
flags |= QTextDocument::FindCaseSensitively;
bool find = logTextEdit->find(ui.searchText->text(), flags);
if(find == false)
{
logTextEdit->moveCursor(QTextCursor::Start);
logTextEdit->find(ui.searchText->text(), flags);
}
}
}
示例3: onClickedSearchPrev
void SourceViewer::onClickedSearchPrev()
{
QTextEdit *logTextEdit = getCurrentSourceEdit();
if(logTextEdit != NULL)
{
QTextDocument::FindFlags flags = QTextDocument::FindBackward;
if(ui.caseSensitiveCheck->isChecked())
flags |= QTextDocument::FindCaseSensitively;
bool find = logTextEdit->find(ui.searchText->text(), flags);
if(find == false)
{
logTextEdit->moveCursor(QTextCursor::End);
logTextEdit->horizontalScrollBar()->setValue(0);
logTextEdit->find(ui.searchText->text(), flags);
}
}
}
示例4: setSourceText
void SourceViewer::setSourceText(const QString &key, const QString &name, const QString &searchText, const QByteArray &sourceTextBuffer)
{
QTextEdit *logTextEdit = NULL;
QTextEditorContextMap::const_iterator i = logTextWidgetMap_.find(key);
if(i == logTextWidgetMap_.end())
{
// New tab created..
logTextEdit = new QTextEdit();
QObject::connect(logTextEdit, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
logTextEdit->setReadOnly(true);
SourceViewContext* ctx = new SourceViewContext();
ctx->logTextEdit = logTextEdit;
logTextWidgetMap_.insert(key, ctx);
ui.tabWidget->insertTab(0, logTextEdit, name);
ui.tabWidget->setCurrentIndex(0);
}
else
{
// Already the tab exists.
logTextEdit = i.value()->logTextEdit;
int index = ui.tabWidget->indexOf(logTextEdit);
if(index >= 0)
{
ui.tabWidget->setCurrentIndex(index);
}
}
workingHighlightText_ = true;
ui.searchText->setText(searchText);
logTextEdit->setText(sourceTextBuffer);
logTextEdit->setFocus();
if(searchText.isEmpty() == false)
{
doHighlightText(searchText, ui.caseSensitiveCheck->isChecked());
QTextDocument::FindFlags flags = 0x0;
if(ui.caseSensitiveCheck->isChecked())
flags |= QTextDocument::FindCaseSensitively;
logTextEdit->moveCursor(QTextCursor::Start);
while(logTextEdit->find(searchText, flags))
{
break;
}
}
workingHighlightText_ = false;
}
示例5: flags
/*!
*/
void
DebugMessageWindow::findString( const QString & expr )
{
// case insentive && no whole word
QTextDocument::FindFlags flags( M_find_forward_rb->isChecked()
? 0
: QTextDocument::FindBackward );
QTextEdit * edit = M_message[ M_tab_widget->currentIndex() ];
if ( ! edit->find( expr, flags ) )
{
if ( M_find_forward_rb->isChecked() )
{
edit->moveCursor( QTextCursor::Start );
}
else
{
edit->moveCursor( QTextCursor::End );
}
edit->find( expr, flags );
}
}
示例6: find
int TextEdit::find(lua_State * L) // ( const QString & exp, QTextDocument::FindFlags options = 0 ) : bool
{
QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
QTextDocument::FindFlags f;
int fInt = Util::toInt( L, 3 );
if( (fInt >= 0 && fInt <= 17) )
{
f = (QTextDocument::FindFlags) fInt;
Lua::Util::push( L, obj->find(Lua::Util::toStr( L, 2 ), f ) );
}
else
Lua::Util::error( L, "expecting a valid QTextDocument::FindFlags" );
return 1;
}
示例7: doHighlightText
void SourceViewer::doHighlightText(const QString &text, bool caseSensitive)
{
qDebug() << "doHighlightText : text=" << text;
workingHighlightText_ = true;
do
{
QTextEdit *logTextEdit = getCurrentSourceEdit();
if(logTextEdit == NULL)
break;
int orgValueVert = logTextEdit->verticalScrollBar()->value();
int orgValueHor = logTextEdit->horizontalScrollBar()->value();
QTextCursor orgCursor = logTextEdit->textCursor();
QTextDocument::FindFlags flags = 0x0;
if(caseSensitive)
flags |= QTextDocument::FindCaseSensitively;
QList<QTextEdit::ExtraSelection> extraSelections;
logTextEdit->moveCursor(QTextCursor::Start);
QColor fgColor = QColor("white");
QColor bgColor = QColor("#C32438");
while(logTextEdit->find(text, flags))
{
QTextEdit::ExtraSelection extra;
extra.format.setForeground(fgColor);
extra.format.setBackground(bgColor);
extra.cursor = logTextEdit->textCursor();
extraSelections.append(extra);
}
logTextEdit->setExtraSelections(extraSelections);
logTextEdit->setTextCursor(orgCursor);
logTextEdit->verticalScrollBar()->setValue(orgValueVert);
logTextEdit->horizontalScrollBar()->setValue(orgValueHor);
} while(false);
workingHighlightText_ = false;
}