本文整理汇总了C++中QSortFilterProxyModel::invalidate方法的典型用法代码示例。如果您正苦于以下问题:C++ QSortFilterProxyModel::invalidate方法的具体用法?C++ QSortFilterProxyModel::invalidate怎么用?C++ QSortFilterProxyModel::invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSortFilterProxyModel
的用法示例。
在下文中一共展示了QSortFilterProxyModel::invalidate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: currentSelected
void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
{
if (current.isValid())
{
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
/*QString name = model->data(current).toString();
QString path = model->data(current, Qt::UserRole).toString();
eUBLibElementType type = (eUBLibElementType)model->data(current, Qt::UserRole + 1).toInt();*/
UBFeature feature = model->data(current, Qt::UserRole + 1).value<UBFeature>();
if ( feature.isFolder() )
{
QString newPath = feature.getFullVirtualPath();
//pathViewer->addPathElement( feature.getThumbnail(), newPath );
controller->setCurrentElement( feature );
model->setFilterFixedString( newPath );
model->invalidate();
switchToListView();
featuresPathModel->setPath( newPath );
featuresPathModel->invalidate();
if ( feature.getType() == FEATURE_FAVORITE )
{
mActionBar->setCurrentState( IN_FAVORITE );
}
else if (feature.getType() == FEATURE_TRASH)
{
mActionBar->setCurrentState( IN_TRASH );
}
else
{
mActionBar->setCurrentState( IN_FOLDER );
}
}
else if ( feature.getType() == FEATURE_SEARCH )
{
webView->showElement( feature );
switchToWebView();
}
else
{
featureProperties->showElement( feature );
switchToProperties();
mActionBar->setCurrentState( IN_PROPERTIES );
}
}
}
示例2: callDataChanged
void DeferredUpdateTreeView::callDataChanged() {
// As the view update is asynchronous, if the original model is wrapped by a QSortFilterProxyModel
// it needs to be invalidate in order to rebuild the index mapping and prevent sefgault
QSortFilterProxyModel *qsfpm = dynamic_cast<QSortFilterProxyModel*>(model());
if (qsfpm) {
qsfpm->invalidate();
}
TreeViewUpdateTimer *tvut = static_cast<TreeViewUpdateTimer*>(sender());
QTreeView::dataChanged(tvut->topLeft, tvut->bottomRight);
QPair<QModelIndex, QModelIndex> p = qMakePair(tvut->topLeft, tvut->bottomRight);
delete _updateTimers[p];
_updateTimers.remove(p);
}
示例3: deleteElements
void UBFeaturesWidget::deleteElements( const QMimeData & mimeData )
{
if ( !mimeData.hasUrls() )
return;
QList<QUrl> urls = mimeData.urls();
foreach ( QUrl url, urls )
{
if ( controller->isTrash( url ) )
{
controller->deleteItem( url );
}
else
{
UBFeature elem = controller->moveItemToFolder( url, controller->getTrashElement() );
controller->removeFromFavorite( url );
featuresModel->addItem( elem );
featuresModel->deleteFavoriteItem( UBFeaturesController::fileNameFromUrl( url ) );
}
}
QSortFilterProxyModel *model = dynamic_cast<QSortFilterProxyModel *>( featuresListView->model() );
model->invalidate();
}