Faster filter

This commit is contained in:
craig
2012-01-03 19:54:24 +00:00
committed by craig
parent 1872cef46f
commit a069ee80fe
5 changed files with 22 additions and 7 deletions

View File

@@ -38,6 +38,10 @@ PlayQueueProxyModel::PlayQueueProxyModel(QObject *parent) : QSortFilterProxyMode
bool PlayQueueProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
if (filterRegExp().isEmpty()) {
return true;
}
int columnCount = sourceModel()->columnCount(sourceParent);
for (int i = 0; i < columnCount; i++) {
@@ -62,11 +66,8 @@ QMimeData *PlayQueueProxyModel::mimeData(const QModelIndexList &indexes) const
}
/* map proxy to real indexes and redirect to sourceModel */
bool PlayQueueProxyModel::dropMimeData(const QMimeData *data,
Qt::DropAction action, int row, int column, const QModelIndex & parent)
bool PlayQueueProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
const QModelIndex index = this->index(row, column, parent);
const QModelIndex sourceIndex = mapToSource(index);
const QModelIndex sourceIndex = mapToSource(index(row, column, parent));
return sourceModel()->dropMimeData(data, action, sourceIndex.row(), sourceIndex.column(), sourceIndex.parent());
}