added option to hide sequences

This commit is contained in:
itsmattkc
2019-01-18 00:19:13 +11:00
parent cc7a6a12b2
commit 016a94f656
7 changed files with 85 additions and 27 deletions
+31
View File
@@ -0,0 +1,31 @@
#include "projectfilter.h"
#include "project/media.h"
#include <QDebug>
ProjectFilter::ProjectFilter(QObject *parent) :
QSortFilterProxyModel(parent),
show_sequences(true)
{}
bool ProjectFilter::get_show_sequences() {
return show_sequences;
}
void ProjectFilter::set_show_sequences(bool b) {
show_sequences = b;
invalidateFilter();
}
bool ProjectFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
if (!show_sequences) {
// hide sequences if show_sequences is false
QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
Media* media = static_cast<Media*>(index.internalPointer());
if (media != nullptr && media->get_type() == MEDIA_TYPE_SEQUENCE) {
return false;
}
}
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}