本文整理汇总了C++中SearchResult类的典型用法代码示例。如果您正苦于以下问题:C++ SearchResult类的具体用法?C++ SearchResult怎么用?C++ SearchResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SearchResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateComboEntries
void BaseFileFind::runNewSearch(const QString &txt, Find::FindFlags findFlags,
SearchResultWindow::SearchMode searchMode)
{
m_currentFindSupport = 0;
if (m_filterCombo)
updateComboEntries(m_filterCombo, true);
SearchResult *search = Find::SearchResultWindow::instance()->startNewSearch(label(),
toolTip().arg(Find::IFindFilter::descriptionForFindFlags(findFlags)),
txt, searchMode, QString::fromLatin1("TextEditor"));
search->setTextToReplace(txt);
search->setSearchAgainSupported(true);
FileFindParameters parameters;
parameters.text = txt;
parameters.flags = findFlags;
parameters.nameFilters = fileNameFilters();
parameters.additionalParameters = additionalParameters();
search->setUserData(qVariantFromValue(parameters));
connect(search, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem)));
if (searchMode == SearchResultWindow::SearchAndReplace) {
connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>)),
this, SLOT(doReplace(QString,QList<Find::SearchResultItem>)));
}
connect(search, SIGNAL(visibilityChanged(bool)), this, SLOT(hideHighlightAll(bool)));
connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool)));
runSearch(search);
}
示例2: updateComboEntries
void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
SearchResultWindow::SearchMode searchMode)
{
d->m_currentFindSupport = 0;
if (d->m_filterCombo)
updateComboEntries(d->m_filterCombo, true);
SearchResult *search = SearchResultWindow::instance()->startNewSearch(label(),
toolTip().arg(IFindFilter::descriptionForFindFlags(findFlags)),
txt, searchMode, SearchResultWindow::PreserveCaseEnabled,
QString::fromLatin1("TextEditor"));
search->setTextToReplace(txt);
search->setSearchAgainSupported(true);
FileFindParameters parameters;
parameters.text = txt;
parameters.flags = findFlags;
parameters.nameFilters = fileNameFilters();
parameters.additionalParameters = additionalParameters();
search->setUserData(qVariantFromValue(parameters));
connect(search, &SearchResult::activated, this, &BaseFileFind::openEditor);
if (searchMode == SearchResultWindow::SearchAndReplace)
connect(search, &SearchResult::replaceButtonClicked, this, &BaseFileFind::doReplace);
connect(search, &SearchResult::visibilityChanged, this, &BaseFileFind::hideHighlightAll);
connect(search, &SearchResult::cancelled, this, &BaseFileFind::cancel);
connect(search, &SearchResult::paused, this, &BaseFileFind::setPaused);
connect(search, &SearchResult::searchAgainRequested, this, &BaseFileFind::searchAgain);
connect(this, &BaseFileFind::enabledChanged, search, &SearchResult::requestEnabledCheck);
connect(search, &SearchResult::requestEnabledCheck, this, &BaseFileFind::recheckEnabled);
runSearch(search);
}
示例3: while
//Processing the results of search done by each thread and constructing a response
void StringProcessor::processMessages(){
sout << "\nIn string processor for string : " << srchString;
try{
int j = 0;
Timer timer; timer.start();
while (true){
SearchResult sr = bqOut.deQ();
if (sr.isFound()){
filesFoundIn.push_back(sr.getFile());
}
//construct response
j++;
if (j == numFiles){
//sout << "\nexiting from string processor";
break;
}
/*for (std::thread* thrd : threads){
thrd->join();
}*/
/*if (bqOut.isEmpty()){
sout << "\nExiting from string processor\n";
break;
}*/
}
timer.stop();
elapsedTime = timer.elapsedTime<std::chrono::milliseconds>();
constructResponse();
}catch (exception e){
sout << e.what();
}
}
示例4: searchAgain
void SymbolsFindFilter::searchAgain()
{
SearchResult *search = qobject_cast<SearchResult *>(sender());
QTC_ASSERT(search, return);
search->restart();
startSearch(search);
}
示例5: SearchResult
QVariantList SearchApi::search(const int moduleID, const QString &queryString)
{
DEBUG_FUNC_NAME
SearchQuery query;
query.searchText = queryString;
query.queryType = SearchQuery::Simple;
query.range = SearchQuery::Whole;
SearchResult *result = new SearchResult();
result->searchQuery = query;
QVariantList res;
Bible *module = (Bible*) m_moduleManager->newTextRangesVerseModule(moduleID);
if(module != nullptr) {
module->search(query, result);
result->sort();
foreach(const SearchHit &h, result->hits()) {
QVariantMap m;
QMapIterator<int, QVariant> i(h.m_map);
while (i.hasNext()) {
i.next();
m[QString::number(i.key())] = i.value();
}
res << QVariant(m);
}
delete result;
delete module;
}
示例6: getWebPage
//void ArestShopPlugin::SinglePageFound()
//{
//#ifdef USE_WEBKIT
// QWebFrame * ptrFrame = getWebPage()->mainFrame();
// parseProductPage(m_stCompData);
// m_stCompData.strCompURL = ptrFrame->url().toString();
// emit priceSearchedFinished(m_stCompData);
// productFoundFinish();
//#endif
//};
void ArestShopPlugin::parseSearchProductPage(SearchResult & stResult,bool & bNextPage)
{
//run XML search page parse
bNextPage=false;
#ifdef USE_WEBKIT
QWebFrame * ptrFrame = getWebPage()->mainFrame();
//////////////////////////////////////////////////////////////////////////
QWebElementCollection tableProdRows = ptrFrame->findAllElements("table[class=pricelist]");
for(int iIndex=0;iIndex<tableProdRows.count();++iIndex)
{
QWebElement prodNameHeader = tableProdRows.at(iIndex).findFirst("td[class=nazwa]");
if (prodNameHeader.isNull())
continue;
QWebElement productLink = prodNameHeader.findFirst("a");
QUrl stProductURL = productLink.attribute("href");
//////////////////////////////////////////////////////////////////////////
QString strName = productLink.toPlainText();
stResult.insert(std::make_pair(strName,stProductURL));
}
//////////////////////////////////////////////////////////////////////////
QWebElement tablePageNavi = ptrFrame->findFirstElement("li[class=next]");
if (tablePageNavi.isNull())
{
bNextPage=false;
return;
}
bNextPage=true;
#endif
stResult.insert(Arest::mSearchResult.begin(),Arest::mSearchResult.end());
bNextPage=m_bLoadNextPage;
}
示例7: SearchResult
/**
* @brief TestAlgorithm::run start the search
* @return a list of data packets containing results
*/
QList<DataPacket*> TestAlgorithm::run() {
QList<DataPacket*> list;
SearchResult* result = new SearchResult();
list.append(dynamic_cast<DataPacket*>(result));
for (QString& datasetPath : mQuery->getDatasets()) {
Dataset dataset(datasetPath);
for (Medium* medium : dataset.getMediaList()) {
if (mCancel == true) {
return list;
}
SearchObject* object = new SearchObject();
object->setMedium(medium->getPath());
object->setSourceDataset(dataset.getPath());
//new result element
SearchResultElement* resultElement = new SearchResultElement();
resultElement->setSearchObject(*object);
resultElement->setScore(std::rand() % 20);
//add to result list
result->addResultElement(*resultElement);
}
}
QThread::msleep(1500);
return list;
}
示例8: foreach
void WindowWithSearchResults::setResults(QList<Movie> movies) {
this->results = movies;
foreach (Movie movie, movies) {
SearchResult *searchResult = new SearchResult(&movie, ui->listWidget, this);
ui->listWidget->addItem(searchResult->getListItem());
searchResult->fetchIcon();
}
示例9: DoOpenSearchResult
void FindResultsTab::DoOpenSearchResult(const SearchResult& result, wxStyledTextCtrl* sci, int markerLine)
{
if(!result.GetFileName().IsEmpty()) {
LEditor* editor = clMainFrame::Get()->GetMainBook()->OpenFile(result.GetFileName());
if(editor && result.GetLen() >= 0) {
// Update the destination position if there have been subsequent changes in the editor
int position = result.GetPosition();
std::vector<int> changes;
editor->GetChanges(changes);
unsigned int changesTotal = changes.size();
int changePosition = 0;
int changeLength = 0;
int resultLength = result.GetLen();
bool removed = false;
for(unsigned int i = 0; i < changesTotal; i += 2) {
changePosition = changes.at(i);
changeLength = changes.at(i + 1);
if((changeLength < 0) && (changePosition - changeLength > position) &&
(changePosition < position + resultLength)) {
// It looks like the data corresponding to this search result has been deleted
// While it's possible that it's been cut, then (later in the changes) re-pasted
// so that the result still matches, it's more likely to have been replaced by different text
// We can't easily tell, so assume the worst and label the result invalid
removed = true;
// Explain the failure
clMainFrame::Get()->GetStatusBar()->SetMessage(_("Search result is no longer valid"));
break;
} else if(changePosition <= position) {
position += changeLength;
}
}
if(!removed) {
editor->SetEnsureCaretIsVisible(
position,
true,
true); // The 3rd parameter sets a small delay, otherwise it fails for long folded files
int lineNumber = editor->LineFromPos(position);
if(lineNumber) {
lineNumber--;
}
editor->SetLineVisible(lineNumber);
editor->SetSelection(position, position + resultLength);
#ifdef __WXGTK__
editor->ScrollToColumn(0);
#endif
if(sci) {
// remove the previous marker and add the new one
sci->MarkerDeleteAll(7);
sci->MarkerAdd(markerLine, 7);
sci->EnsureVisible(markerLine);
sci->GotoLine(markerLine);
}
}
}
}
}
示例10: finish
void SymbolsFindFilter::finish()
{
auto watcher = static_cast<QFutureWatcher<SearchResultItem> *>(sender());
SearchResult *search = m_watchers.value(watcher);
if (search)
search->finishSearch(watcher->isCanceled());
m_watchers.remove(watcher);
watcher->deleteLater();
}
示例11: downloadTorrent
void QSearchDisplayModel::downloadTorrent()
{
if (m_pTorrentListView->model() != this)
{
return;
}
QModelIndex index = m_pTorrentListView->currentIndex();
SearchResult* searchResult = index.data(SearchItemRole).value<SearchResult*>();
m_pTorrentDownloader->download(searchResult->TorrentFileUrl());
}
示例12: addResults
void SymbolsFindFilter::addResults(int begin, int end)
{
auto watcher = static_cast<QFutureWatcher<SearchResultItem> *>(sender());
SearchResult *search = m_watchers.value(watcher);
if (!search) {
// search was removed from search history while the search is running
watcher->cancel();
return;
}
QList<SearchResultItem> items;
for (int i = begin; i < end; ++i)
items << watcher->resultAt(i);
search->addResults(items, SearchResult::AddSorted);
}
示例13: kDebug
void
GaduEditAccount::slotSearchResult( const SearchResult& result, unsigned int seq )
{
if ( !( seq != 0 && seqNr != 0 && seq == seqNr ) || result.isEmpty() ) {
return;
}
connectLabel->setText( " " );
uiName->setText( result[0].firstname );
uiSurname->setText( result[0].surname );
nickName->setText( result[0].nickname );
uiYOB->setText( result[0].age );
uiCity->setText( result[0].city );
kDebug( 14100 ) << "gender found: " << result[0].gender;
if ( result[0].gender == QString( GG_PUBDIR50_GENDER_SET_FEMALE ) ) {
uiGender->setCurrentIndex( 1 );
kDebug(14100) << "looks like female";
}
else {
if ( result[0].gender == QString( GG_PUBDIR50_GENDER_SET_MALE ) ) {
uiGender->setCurrentIndex( 2 );
kDebug( 14100 ) <<" looks like male";
}
}
uiMeiden->setText( result[0].meiden );
uiOrgin->setText( result[0].orgin );
enableUserInfo( true );
disconnect( SLOT(slotSearchResult(SearchResult,uint)) );
}
示例14: QVariant
QVariant QSearchDisplayModel::data(const QModelIndex& index, int role /*= Qt::DisplayRole*/) const
{
if(index.isValid())
{
int row = index.row();
int col = index.column();
SearchItemsStorragePtr results = m_pSearchEngine->GetResults();
if(row > results->length())
{
return QVariant();
}
SearchResult* res = (*results) [row];
switch(role)
{
case SearchItemRole:
{
return qVariantFromValue(res);
}
case SearchItemName:
{
return res->Name();
}
case SearchItemSize:
{
return res->Size();
}
case SearchItemSeeders:
{
return res->Seeders();
}
case SearchItemPeers:
{
return res->Leechers();
}
}
}
return QVariant();
}
示例15: toolTip
void SymbolsFindFilter::findAll(const QString &txt, FindFlags findFlags)
{
SearchResultWindow *window = SearchResultWindow::instance();
SearchResult *search = window->startNewSearch(label(), toolTip(findFlags), txt);
search->setSearchAgainSupported(true);
connect(search, SIGNAL(activated(Core::SearchResultItem)),
this, SLOT(openEditor(Core::SearchResultItem)));
connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool)));
window->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
SymbolSearcher::Parameters parameters;
parameters.text = txt;
parameters.flags = findFlags;
parameters.types = m_symbolsToSearch;
parameters.scope = m_scope;
search->setUserData(qVariantFromValue(parameters));
startSearch(search);
}