当前位置: 首页>>代码示例>>C++>>正文


C++ Search::immediatelyFindPhrase方法代码示例

本文整理汇总了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();
}
开发者ID:wagenadl,项目名称:eln,代码行数:49,代码来源:SearchDialog.cpp


注:本文中的Search::immediatelyFindPhrase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。