本文整理汇总了C++中Search::immediatelyFindPhrase方法的典型用法代码示例。如果您正苦于以下问题:C++ Search::immediatelyFindPhrase方法的具体用法?C++ Search::immediatelyFindPhrase怎么用?C++ Search::immediatelyFindPhrase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::immediatelyFindPhrase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newSearch
void SearchDialog::newSearch() {
QString phrase = QInputDialog::getText(pgView, "Search in notebook",
"Search phrase:",
QLineEdit::Normal,
lastPhrase);
lastPhrase = phrase;
if (phrase.isEmpty())
return;
QProgressDialog *progress = new QProgressDialog(pgView);
progress->setLabelText("Searching...");
progress->setCancelButton(0);
progress->setMinimumDuration(500);
progress->setValue(0);
Search *search = new Search(pgView->notebook());
QList<SearchResult> res = search->immediatelyFindPhrase(phrase);
if (res.isEmpty()) {
delete progress;
QMessageBox::information(pgView, "Search - eln",
QString::fromUtf8("Search phrase “%1” not found")
.arg(phrase));
return;
}
SearchResultScene *scene
= new SearchResultScene(phrase,
QString::fromUtf8("Search results for “%1”")
.arg(phrase),
res,
pgView->notebook()->bookData());
scene->populate();
connect(scene,
SIGNAL(pageNumberClicked(int, Qt::KeyboardModifiers,
QString, QString)),
this,
SLOT(gotoPage(int, Qt::KeyboardModifiers, QString, QString)));
SearchView *view = new SearchView(scene);
view->setAttribute(Qt::WA_DeleteOnClose, true);
connect(parent(), SIGNAL(destroyed()), view, SLOT(close()));
delete progress;
view->resize(pgView->size()*.9);
QString ttl = pgView->notebook()->bookData()->title();
view->setWindowTitle("Search in: "
+ ttl.replace(QRegExp("\\s\\s*"), " ") + " - eln");
view->show();
}