PlaylistTableProxyModel::PlaylistTableProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{
	setDynamicSortFilter(true);
	setFilterCaseSensitivity(Qt::CaseInsensitive);
	setSortCaseSensitivity(Qt::CaseInsensitive);
	setSortLocaleAware(true);
}
ChatMessageSortFilterProxyModel::ChatMessageSortFilterProxyModel(QObject *parent) :
    QSortFilterProxyModel(parent)
{
    setSortLocaleAware(true);
    setDynamicSortFilter(true);
    setSortCaseSensitivity(Qt::CaseInsensitive);
}
TilesetDocumentsFilterModel::TilesetDocumentsFilterModel(QObject *parent)
    : QSortFilterProxyModel(parent)
    , mMapDocument(nullptr)
{
    setSortLocaleAware(true);
    setSourceModel(DocumentManager::instance()->tilesetDocumentsModel());
    sort(0);
}
Exemple #4
0
QgsLocatorProxyModel::QgsLocatorProxyModel( QObject *parent )
  : QSortFilterProxyModel( parent )
{
  setDynamicSortFilter( true );
  setSortLocaleAware( true );
  setFilterCaseSensitivity( Qt::CaseInsensitive );
  sort( 0 );
}
Exemple #5
0
PodcastService::Proxy::Proxy(QObject *parent)
    : ProxyModel(parent)
{
    setDynamicSortFilter(true);
    setFilterCaseSensitivity(Qt::CaseInsensitive);
    setSortCaseSensitivity(Qt::CaseInsensitive);
    setSortLocaleAware(true);
}
MusicLibraryProxyModel::MusicLibraryProxyModel(QObject *parent)
    : ProxyModel(parent)
{
    setDynamicSortFilter(true);
    setFilterCaseSensitivity(Qt::CaseInsensitive);
    setSortCaseSensitivity(Qt::CaseInsensitive);
    setSortLocaleAware(true);
}
Exemple #7
0
UsersModel::UsersModel(QObject* parent)
  : UnitySortFilterProxyModelQML(parent)
{
    setModel(new MangleModel(this));
    setSortCaseSensitivity(Qt::CaseInsensitive);
    setSortLocaleAware(true);
    setSortRole(QLightDM::UsersModel::RealNameRole);
    sort(0);
}
Exemple #8
0
UserListFilterProxyModel::UserListFilterProxyModel(QObject *parent_)
	: QSortFilterProxyModel(parent_)
	, m_minimumInactiveDays(0) {

	setFilterKeyColumn(UserListModel::COL_NICK);
	setFilterCaseSensitivity(Qt::CaseInsensitive);
	setSortLocaleAware(true);
	setDynamicSortFilter(true);
}
QgsMapLayerProxyModel::QgsMapLayerProxyModel( QObject *parent )
    : QSortFilterProxyModel( parent )
    , mFilters( All )
    , mExceptList( QList<QgsMapLayer*>() )
    , mModel( new QgsMapLayerModel( parent ) )
{
  setSourceModel( mModel );
  setDynamicSortFilter( true );
  setSortLocaleAware( true );
  setFilterCaseSensitivity( Qt::CaseInsensitive );
  sort( 0 );
}
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;
}
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);
}
Exemple #12
0
QgsComposerProxyModel::QgsComposerProxyModel( QgsComposition *composition, QObject *parent )
    : QSortFilterProxyModel( parent )
    , mComposition( composition )
    , mItemTypeFilter( QgsComposerItem::ComposerItem )
{
  if ( mComposition )
    setSourceModel( mComposition->itemsModel() );

  // TODO doesn't seem to work correctly - not updated when item changes
  setDynamicSortFilter( true );
  setSortLocaleAware( true );
  sort( QgsComposerModel::ItemId );
}
Exemple #13
0
QgsComposerProxyModel::QgsComposerProxyModel( QgsComposition *composition, QObject *parent )
  : QSortFilterProxyModel( parent )
  , mComposition( composition )
  , mItemTypeFilter( QgsComposerItem::ComposerItem )
{
  if ( mComposition )
    setSourceModel( mComposition->itemsModel() );

  // WARNING: the below code triggers a Qt bug (tested on Qt 4.8, can't reproduce on Qt5) whenever the QgsComposerModel source model
  // calls beginInsertRows - since it's non functional anyway it's now disabled
  // PLEASE verify that the Qt issue is fixed before reenabling
#if 0
  // TODO doesn't seem to work correctly - not updated when item changes
  setDynamicSortFilter( true );
  setSortLocaleAware( true );
  sort( QgsComposerModel::ItemId );
#endif
}
Exemple #14
0
FolderModel::FolderModel(QObject *parent) : QSortFilterProxyModel(parent),
    m_dirWatch(nullptr),
    m_dragInProgress(false),
    m_previewGenerator(0),
    m_viewAdapter(0),
    m_actionCollection(this),
    m_newMenu(0),
    m_fileItemActions(0),
    m_usedByContainment(false),
    m_locked(true),
    m_sortMode(0),
    m_sortDesc(false),
    m_sortDirsFirst(true),
    m_parseDesktopFiles(false),
    m_previews(false),
    m_filterMode(NoFilter),
    m_filterPatternMatchAll(true)
{
    DirLister *dirLister = new DirLister(this);
    dirLister->setDelayedMimeTypes(true);
    dirLister->setAutoErrorHandlingEnabled(false, 0);
    connect(dirLister, &DirLister::error, this, &FolderModel::dirListFailed);
    connect(dirLister, &KCoreDirLister::itemsDeleted, this, &FolderModel::evictFromIsDirCache);

    m_dirModel = new KDirModel(this);
    m_dirModel->setDirLister(dirLister);
    m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory | KDirModel::DropOnLocalExecutable);

    m_selectionModel = new QItemSelectionModel(this, this);
    connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(selectionChanged(QItemSelection,QItemSelection)));

    setSourceModel(m_dirModel);

    setSortLocaleAware(true);
    setFilterCaseSensitivity(Qt::CaseInsensitive);
    setDynamicSortFilter(true);

    sort(m_sortMode, m_sortDesc ? Qt::DescendingOrder : Qt::AscendingOrder);

    setSupportedDragActions(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction);

    createActions();
}
void DwarfModelProxy::sort(int column, DWARF_SORT_ROLE role) {
	Qt::SortOrder order;
	if (column == 0) {
		switch(role) {
			case DSR_NAME_ASC:
				order = Qt::AscendingOrder;
				setSortRole(Qt::DisplayRole);
				break;
			case DSR_NAME_DESC:
				order = Qt::DescendingOrder;
				setSortRole(Qt::DisplayRole);
				break;
			case DSR_ID_ASC:
				order = Qt::AscendingOrder;
				setSortRole(DwarfModel::DR_ID);
				break;
			case DSR_ID_DESC:
				order = Qt::DescendingOrder;
				setSortRole(DwarfModel::DR_ID);
				break;
			case DSR_GAME_ORDER:
				order = Qt::AscendingOrder;
				setSortRole(DwarfModel::DR_SORT_VALUE);
				break;
		}
	} else {
		switch(role) {
			case DSR_NAME_ASC:
				order = Qt::AscendingOrder;
				break;
			case DSR_NAME_DESC:
				order = Qt::DescendingOrder;
				break;
		}
		setSortRole(DwarfModel::DR_SORT_VALUE);
	}
	setFilterCaseSensitivity(Qt::CaseInsensitive);
	setSortLocaleAware(true);
	QSortFilterProxyModel::sort(column, order);
}