Example #1
0
MenuProxyModel::MenuProxyModel( QObject * parent )
    : KCategorizedSortFilterProxyModel( parent )
{
    setSortRole( MenuModel::UserSortRole );
    setFilterRole( MenuModel::UserFilterRole );
    setFilterCaseSensitivity( Qt::CaseInsensitive );
}
QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model) :
    m_model(model)
{
    setViewDefaults(this);
    setObjectName(QLatin1String("QmlProfilerEventsTable"));

    auto sortModel = new QSortFilterProxyModel(this);
    sortModel->setSourceModel(model);
    sortModel->setSortRole(SortRole);
    sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    sortModel->setFilterRole(FilterRole);
    sortModel->setFilterKeyColumn(MainType);
    sortModel->setFilterFixedString("+");

    setModel(sortModel);

    connect(this, &QAbstractItemView::activated, this, [this](const QModelIndex &index) {
        jumpToItem(index.data(TypeIdRole).toInt());
    });

    setSortingEnabled(true);
    sortByColumn(DEFAULT_SORT_COLUMN, Qt::DescendingOrder);

    setShowExtendedStatistics(m_showExtendedStatistics);
    setRootIsDecorated(false);

    resizeColumnToContents(MainLocation);
    resizeColumnToContents(MainType);
}
Example #3
0
UPnPRendererModel::UPnPRendererModel(QObject *parent)
   : QSortFilterProxyModel (parent)
{
    setSourceModel(UPnPDeviceModel::getDefault());
    setFilterRole(UPnPDeviceModel::DeviceRoleType);
    setFilterRegExp(QRegExp(RENDERER_PATTERN));
}
KNMusicCategoryDetailModel::KNMusicCategoryDetailModel(QObject *parent) :
    QSortFilterProxyModel(parent)
{
    m_nameFilter.setPattern("^$");
    m_nameFilter.setPatternSyntax(QRegExp::RegExp);
    setFilterRegExp(m_nameFilter);
    setFilterRole(Qt::DisplayRole);
}
Example #5
0
	FontFilter::FontFilter(QObject *parent):
		QAbstractProxyModel(parent),
		m_search_result_count(0),
		m_show_only_selected(false),
		m_displayed_fonts_count(100) {
		setFilterRole(Qt::UserRole);

	}
Example #6
0
SelectTaskDialogProxy::SelectTaskDialogProxy( CharmDataModel* model, QObject* parent )
    : ViewFilter( model, parent )
{
    // we filter for the task name column
    setFilterKeyColumn( Column_TaskId );
    setFilterCaseSensitivity( Qt::CaseInsensitive );
    setFilterRole( TasksViewRole_Filter );
    prefilteringModeChanged();
}
void SortFilterModel::setModel(QObject *model)
{
    QAbstractItemModel* tmpModel = qobject_cast<QAbstractItemModel*>(model);
    if (tmpModel == NULL)
        return;
    setSourceModel(tmpModel);

    setSortRole(m_sortRole);
    setFilterRole(m_filterRole);
}
TorrentContentFilterModel::TorrentContentFilterModel(QObject *parent):
  QSortFilterProxyModel(parent), m_model(new TorrentContentModel(this))
{
  connect(m_model, SIGNAL(filteredFilesChanged()), this, SIGNAL(filteredFilesChanged()));
  setSourceModel(m_model);
  // Filter settings
  setFilterKeyColumn(TorrentContentModelItem::COL_NAME);
  setFilterRole(Qt::DisplayRole);
  setDynamicSortFilter(true);
  setSortCaseSensitivity(Qt::CaseInsensitive);
}
int QSortFilterProxyModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractProxyModel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 20)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 20;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QRegExp*>(_v) = filterRegExp(); break;
        case 1: *reinterpret_cast< int*>(_v) = filterKeyColumn(); break;
        case 2: *reinterpret_cast< bool*>(_v) = dynamicSortFilter(); break;
        case 3: *reinterpret_cast< Qt::CaseSensitivity*>(_v) = filterCaseSensitivity(); break;
        case 4: *reinterpret_cast< Qt::CaseSensitivity*>(_v) = sortCaseSensitivity(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isSortLocaleAware(); break;
        case 6: *reinterpret_cast< int*>(_v) = sortRole(); break;
        case 7: *reinterpret_cast< int*>(_v) = filterRole(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setFilterRegExp(*reinterpret_cast< QRegExp*>(_v)); break;
        case 1: setFilterKeyColumn(*reinterpret_cast< int*>(_v)); break;
        case 2: setDynamicSortFilter(*reinterpret_cast< bool*>(_v)); break;
        case 3: setFilterCaseSensitivity(*reinterpret_cast< Qt::CaseSensitivity*>(_v)); break;
        case 4: setSortCaseSensitivity(*reinterpret_cast< Qt::CaseSensitivity*>(_v)); break;
        case 5: setSortLocaleAware(*reinterpret_cast< bool*>(_v)); break;
        case 6: setSortRole(*reinterpret_cast< int*>(_v)); break;
        case 7: setFilterRole(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #10
0
MessagesProxyModel::MessagesProxyModel(QObject *parent)
  : QSortFilterProxyModel(parent) {
  m_sourceModel = new MessagesModel(this);

  setObjectName(QSL("MessagesProxyModel"));
  setSortRole(Qt::EditRole);
  setSortCaseSensitivity(Qt::CaseInsensitive);
  setFilterCaseSensitivity(Qt::CaseInsensitive);
  setFilterKeyColumn(-1);
  setFilterRole(Qt::EditRole);
  setDynamicSortFilter(false);
  setSourceModel(m_sourceModel);
}
FChannelListSortProxy::FChannelListSortProxy(QObject *parent) :
	QSortFilterProxyModel(parent),
    _showType(FChannelSummary::Unknown),
    _showEmpty(false)
{
	setDynamicSortFilter(true);
	setSortRole(FChannelListModel::SortKeyRole);
	setFilterRole(FChannelListModel::SortKeyRole);
    setFilterKeyColumn(-1);
	setSortLocaleAware(true);
	setSortCaseSensitivity(Qt::CaseInsensitive);
	setFilterCaseSensitivity(Qt::CaseInsensitive);
}
Example #12
0
BrowseModel::BrowseModel(ServiceProxyCall *call, const QString &protocolInfo, QObject *parent)
    : QSortFilterProxyModel(parent)
    , d_ptr(new BrowseModelPrivate(call, protocolInfo, this))
{
    Q_D(BrowseModel);
    setSourceModel(d);
    setFilterRole(d->m_settings.filterInDetails() ? BrowseModelPrivate::BrowseRoleFilter : BrowseModelPrivate::BrowseRoleTitle);
    setFilterCaseSensitivity(Qt::CaseInsensitive);

    connect(d, SIGNAL(busyChanged()), SIGNAL(busyChanged()));
    connect(d, SIGNAL(doneChanged()), SIGNAL(doneChanged()));
    connect(d, SIGNAL(error(int,QString)), SIGNAL(error(int,QString)));
    connect(d, SIGNAL(lastIndexChanged()), SIGNAL(lastIndexChanged()));
    connect(d, SIGNAL(protocolInfoChanged()), SIGNAL(protocolInfoChanged()));
}
Example #13
0
void SortFilterModel::syncRoleNames()
{
    if (!sourceModel()) {
        return;
    }

    m_roleIds.clear();
    const QHash<int, QByteArray> rNames = roleNames();
    for (auto i = rNames.constBegin(); i != rNames.constEnd(); ++i) {
        m_roleIds[i.value()] = i.key();
    }

    setRoleNames(sourceModel()->roleNames());
    setFilterRole(m_filterRole);
    setSortRole(m_sortRole);
}
BtModuleNameFilterProxyModel::BtModuleNameFilterProxyModel(QObject *parent)
        : QSortFilterProxyModel(parent), m_enabled(true) {
    setFilterRole(BtBookshelfModel::ModuleNameRole);
    setFilterCaseSensitivity(Qt::CaseInsensitive);
}
Example #15
0
//------------------------------------------------------------------------------
FolderFilterObject::FolderFilterObject()
	: QtFilterObject( false )
{
	setFilterRole(Directory);
}
Example #16
0
SortFilterProxy::SortFilterProxy(QObject *parent) : QSortFilterProxyModel(parent) 
{
   setFilterRole(SearchTextRole);
   setRecurse(true);
}