void NavigationWidgetPrivate::setSearchResult( QVector<GeoDataPlacemark*> locations )
{
    if( locations.isEmpty() ) {
        return;
    }

    QTime t;
    t.start();

    // fill the local document with results
    m_widget->model()->placemarkSelectionModel()->clear();
    GeoDataTreeModel *treeModel = m_widget->model()->treeModel();
    treeModel->removeDocument( m_document );
    m_document->clear();
    foreach (GeoDataPlacemark *placemark, locations ) {
        m_document->append( new GeoDataPlacemark( *placemark ) );
    }
Exemple #2
0
void SearchWidgetPrivate::clearSearch()
{
    m_widget->model()->placemarkSelectionModel()->clear();

    // clear the local document
    GeoDataTreeModel *treeModel = m_widget->model()->treeModel();
    treeModel->removeDocument( m_document );
    m_document->clear();
    treeModel->addDocument( m_document );
    m_branchfilter.setBranchIndex( treeModel, treeModel->index( m_document ) );
    m_searchResultView->setRootIndex(
            m_sortproxy.mapFromSource(
                m_branchfilter.mapFromSource( treeModel->index( m_document ) ) ) );

    // clear cached search results
    m_runnerManager->findPlacemarks( QString() );
}
void NavigationWidget::clearSearch()
{
    d->m_searchTerm.clear();

    d->m_navigationUi.locationListView->setVisible( false );
    d->m_widget->model()->placemarkSelectionModel()->clear();

    // clear the local document
    GeoDataTreeModel *treeModel = d->m_widget->model()->treeModel();
    treeModel->removeDocument( d->m_document );
    d->m_document->clear();
    treeModel->addDocument( d->m_document );
    d->m_branchfilter.setBranchIndex( treeModel, treeModel->index( d->m_document ) );
    d->m_navigationUi.locationListView->setRootIndex(
            d->m_sortproxy->mapFromSource(
                d->m_branchfilter.mapFromSource( treeModel->index( d->m_document ) ) ) );

    // clear cached search results
    d->m_runnerManager->findPlacemarks( QString() );
}