Exemplo n.º 1
0
/*!
    Returns MIME data for the specified \a indexes in the model.
*/
QMimeData *QProxyModel::mimeData(const QModelIndexList &indexes) const
{
    Q_D(const QProxyModel);
    QModelIndexList lst;
    for (int i = 0; i < indexes.count(); ++i)
        lst.append(setSourceModel(indexes.at(i)));
    return d->model->mimeData(lst);
}
Exemplo n.º 2
0
ApplicationFilterModel::ApplicationFilterModel(QAbstractItemModel *sourceModel,
                                               QObject *parent) :
    QSortFilterProxyModel(parent)
{
    PANORAMA_INITIALIZE(ApplicationFilterModel);
    setSourceModel(sourceModel);
    setRoleNames(sourceModel->roleNames());
}
Exemplo n.º 3
0
MessageFilter::MessageFilter(MessageModel *source, const QList<BufferId> &buffers, QObject *parent)
    : QSortFilterProxyModel(parent),
    _validBuffers(buffers.toSet()),
    _messageTypeFilter(0)
{
    init();
    setSourceModel(source);
}
Exemplo n.º 4
0
HistoryFilterModel::HistoryFilterModel(QObject * parent)
        : QSortFilterProxyModel(parent)
{
    setSourceModel(HistoryManager::historyManager());

    setDynamicSortFilter(true);
    setFilterKeyColumn(-1);
}
Exemplo n.º 5
0
/******************************************************************************************
 * NickViewFilter
 ******************************************************************************************/
NickViewFilter::NickViewFilter(const BufferId &bufferId, NetworkModel *parent)
    : QSortFilterProxyModel(parent),
    _bufferId(bufferId)
{
    setSourceModel(parent);
    setDynamicSortFilter(true);
    setSortCaseSensitivity(Qt::CaseInsensitive);
    setSortRole(TreeModel::SortRole);
}
Exemplo n.º 6
0
BufferModel::BufferModel(NetworkModel *parent)
  : QSortFilterProxyModel(parent),
    _selectionModelSynchronizer(this)
{
  setSourceModel(parent);
  if(Quassel::isOptionSet("debugbufferswitches")) {
    connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
	    this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &)));
  }
Exemplo n.º 7
0
WindowedBlockModel::WindowedBlockModel(ICryptoNoteAdapter* _cryptoNoteAdapter, QAbstractItemModel* _blockChainModel,
  QObject* _parent) : WalletWindowedItemModel(BlockchainModel::ROLE_BLOCK_HEIGHT, _parent),
  m_cryptoNoteAdapter(_cryptoNoteAdapter) {
  setSourceModel(new FilteredBlockModel(m_cryptoNoteAdapter, _blockChainModel, this));
  setDynamicSortFilter(true);
  sort(BlockchainModel::COLUMN_BLOCK_HEIGHT, Qt::DescendingOrder);
  connect(sourceModel(), &QAbstractItemModel::rowsInserted, this, &WindowedBlockModel::blocksAdded);
  connect(sourceModel(), &QAbstractItemModel::rowsRemoved, this, &WindowedBlockModel::blocksRemoved);
}
Exemplo n.º 8
0
qCheckboxFilterModel::qCheckboxFilterModel(QAbstractItemModel *src_mdl, int visible_col, int id_col, QObject *parent):
  QSortFilterProxyModel(parent),
  srcModel(src_mdl, parent),
  ShowCheckboxes(false),
  Checkboxed_Column(visible_col),
  Id_Column(id_col)
{
  setSourceModel(&srcModel);
}
Exemplo n.º 9
0
FileModel::FileModel(QObject *parent):
    QSortFilterProxyModel(parent),
    m_model(new QFileSystemModel(this))
{
    setDynamicSortFilter(true);
    setSourceModel(m_model);

    m_model->setNameFilterDisables(false);
}
Exemplo n.º 10
0
DevicesSortProxyModel::DevicesSortProxyModel(DevicesModel* devicesModel)
    : QSortFilterProxyModel(devicesModel)
{
    setSourceModel(devicesModel);
    setSortRole(DevicesModel::StatusModelRole);
    connect(devicesModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            this, SLOT(sourceDataChanged(QModelIndex,QModelIndex)));
    sort(0);
}
QgsAttributeTableFilterModel::QgsAttributeTableFilterModel( QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent )
  : QSortFilterProxyModel( parent )
  , mCanvas( canvas )
{
  setSourceModel( sourceModel );
  setDynamicSortFilter( true );
  setSortRole( QgsAttributeTableModel::SortRole );
  connect( layer(), &QgsVectorLayer::selectionChanged, this, &QgsAttributeTableFilterModel::selectionChanged );
}
BufferViewOverlayFilter::BufferViewOverlayFilter(QAbstractItemModel *model, BufferViewOverlay *overlay)
    : QSortFilterProxyModel(model),
    _overlay(0)
{
    setOverlay(overlay);
    setSourceModel(model);

    setDynamicSortFilter(true);
}
Exemplo n.º 13
0
SourcesProxyModel::SourcesProxyModel( SourcesModel* model, QObject* parent )
    : QSortFilterProxyModel( parent )
    , m_model( model )
    , m_filtered( false )
{
    setDynamicSortFilter( true );

    setSourceModel( model );
}
Exemplo n.º 14
0
ImapAccountListModel::ImapAccountListModel(QObject *parent) :
    QSortFilterProxyModel(parent)
{
    accountListModel = new QMailAccountListModel();
    accountListModel->setSynchronizeEnabled(true);
    setSourceModel(accountListModel);

    m_roles[AccountNameRole] = "accountName";
    m_roles[AccountIdRole] = "accountId";
}
Exemplo n.º 15
0
/**
 * Subset of the instantMessagingModel() with only plain text and HTML
 * messages. This model can be displayed directly to the user.
 */
QAbstractItemModel* Media::TextRecording::instantTextMessagingModel() const
{
    if (!d_ptr->m_pTextMessagesModel) {
        auto p = new TextProxyModel(const_cast<TextRecording*>(this));
        p->setSourceModel(instantMessagingModel());
        d_ptr->m_pTextMessagesModel = p;
    }

    return d_ptr->m_pTextMessagesModel;
}
Exemplo n.º 16
0
/**
 * Subset of the instantTextMessagingModel() with only unread plain text and HTML
 * messages. This model can be used to get the number of unread messages.
 */
QAbstractItemModel* Media::TextRecording::unreadInstantTextMessagingModel() const
{
    if (!d_ptr->m_pUnreadTextMessagesModel) {
        auto p = new UnreadProxyModel(instantTextMessagingModel());
        p->setSourceModel(instantTextMessagingModel());
        d_ptr->m_pUnreadTextMessagesModel = p;
    }

    return d_ptr->m_pUnreadTextMessagesModel;
}
Exemplo n.º 17
0
TaskSortFilter::TaskSortFilter(TaskModel *model, QObject* parent)
  : QSortFilterProxyModel(parent),
    m_model(model),
    filterOn(All),
    sortBy(SortPriority)
{
  setSourceModel(model);
  setDynamicSortFilter(true);
  setFilterCaseSensitivity(Qt::CaseInsensitive);
}
Exemplo n.º 18
0
void SortFilterModel::setModel(QObject *model)
{
    QAbstractItemModel* tmpModel = qobject_cast<QAbstractItemModel*>(model);
    if (tmpModel == NULL)
        return;
    setSourceModel(tmpModel);

    setSortRole(m_sortRole);
    setFilterRole(m_filterRole);
}
Exemplo n.º 19
0
BeerXMLSortProxyModel::BeerXMLSortProxyModel(QAbstractItemModel* sourceModel)
   : QSortFilterProxyModel(sourceModel)
{
   if( sourceModel )
   {
      setSourceModel(sourceModel);
      setDynamicSortFilter(true);
      sort(0);
   }
}
QgsAttributeTableFilterModel::QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent )
    : QSortFilterProxyModel( parent )
    , mCanvas( canvas )
    , mFilterMode( ShowAll )
    , mSelectedOnTop( false )
{
  setSourceModel( sourceModel );
  setDynamicSortFilter( true );
  setSortRole( QgsAttributeTableModel::SortRole );
  connect( layer(), SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
}
Exemplo n.º 21
0
SearchHistoryModel::SearchHistoryModel(QObject *parent) :
    QSortFilterProxyModel(parent),
    m_model(new QStringListModel(Settings::instance()->searchHistory(), this)),
    m_alignment(Qt::AlignCenter)
{
    setSourceModel(m_model);
    setFilterCaseSensitivity(Qt::CaseInsensitive);
    setDynamicSortFilter(true);

    connect(Settings::instance(), SIGNAL(searchHistoryChanged()), this, SLOT(reload()));
}
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);
}
ProxyBase::ProxyBase( AbstractModel *belowModel, QObject *parent )
    : QSortFilterProxyModel( parent )
    , m_belowModel( belowModel )
{
    setSourceModel( m_belowModel->qaim() );

    // Proxy the Playlist::AbstractModel signals.
    //   If you need to do something special in a subclass, disconnect() this signal and
    //   do your own connect() call.
    connect( sourceModel(), SIGNAL(activeTrackChanged(quint64)), this, SIGNAL(activeTrackChanged(quint64)) );
    connect( sourceModel(), SIGNAL(queueChanged()), this, SIGNAL(queueChanged()) );
}
Exemplo n.º 24
0
MessageListModel::MessageListModel(
        const std::shared_ptr<Kullo::Api::Session> &session,
        ApiMirror::EventDispatcher &eventDispatcher,
        Kullo::id_type convId,
        QObject *parent)
    : QSortFilterProxyModel(parent)
    , source_(new MessageListSource(session, eventDispatcher, convId, nullptr))
{
    setSourceModel(source_.get());
    sort(0, Qt::DescendingOrder);
    setDynamicSortFilter(true);
}
Exemplo n.º 25
0
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 );
}
Exemplo n.º 26
0
SeasideProxyModel::SeasideProxyModel(QObject *parent)
{
    Q_UNUSED(parent);
    priv = new SeasideProxyModelPriv;
    priv->filterType = FilterAll;
    priv->localeHelper = LocaleUtils::self();
    setDynamicSortFilter(true);
    setFilterKeyColumn(-1);

    setSourceModel(SeasidePeopleModel::instance());
    sort(0, Qt::AscendingOrder);
}
Exemplo n.º 27
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);
}
Exemplo n.º 28
0
EventModelFilter::EventModelFilter( CharmDataModel* model, QObject* parent )
    : QSortFilterProxyModel( parent )
    , m_model( model )
{
    setSourceModel( &m_model );
    setDynamicSortFilter( true );
    sort( 0, Qt::AscendingOrder );

    connect( &m_model, SIGNAL( eventActivationNotice( EventId ) ),
             SIGNAL( eventActivationNotice( EventId ) ) );
    connect( &m_model, SIGNAL( eventDeactivationNotice( EventId ) ),
             SIGNAL( eventDeactivationNotice( EventId ) ) );
}
Exemplo n.º 29
0
ProxyTrackModel::ProxyTrackModel(QAbstractItemModel* pTrackModel,
                                 bool bHandleSearches)
        // ProxyTrackModel proxies settings requests to the composed TrackModel,
        // don't initialize its TrackModel with valid parameters.
        : TrackModel(QSqlDatabase(), ""),
          m_pTrackModel(dynamic_cast<TrackModel*>(pTrackModel)),
          m_currentSearch(""),
          m_bHandleSearches(bHandleSearches) {
    DEBUG_ASSERT_AND_HANDLE(m_pTrackModel && pTrackModel) {
        return;
    }
    setSourceModel(pTrackModel);
}
Exemplo n.º 30
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 );
}