[Qt-interest] Proxy model with more indexes than its source model
Alexandre Beraud
aberaud at infflux.com
Mon Feb 8 19:03:01 CET 2010
Hi,
data() IS virtual (see QAbstractItemModel: virtual QVariant *data
<qabstractitemmodel.html#data>* ( const QModelIndex & /index/,
int /role/ = Qt::DisplayRole ) const = 0). Otherwise there would be no
point is subclassing QAbstractItemModel.
Regards,
Alex
Jugdish a écrit :
> Is it possible to have a proxy model that has more indexes than its
> underlying source model?
>
> I'd like to have a proxy model that inserts additional "header" rows
> which act as separators between blocks of rows from the source model.
> The proxy model would know which rows indexes correspond to the header
> rows, and it would offset the source model rows to make room for the
> additional rows.
>
> The problem I'm facing is that QAbstractProxyModel really only gives
> access to mapToSource() and mapFromSource(), which assume that there
> is a source model index corresponding to every proxy model index. But
> since the header rows only exist in the proxy model, I need to somehow
> deal with that scenario. My first hunch was to re-implement
> QAbstractProxyModel::data(), but unfortunately it is not declared as
> virtual.
>
> Any ideas?
>
> Thanks,
> -Jugdish
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Alexandre BERAUD
Ingénieur Développement
Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site : www.infflux.com
More information about the Qt-interest-old
mailing list