#include <KDChartAbstractProxyModel.h>
Inheritance diagram for KDChart::AbstractProxyModel:
Public Member Functions | |
AbstractProxyModel (QObject *parent=0) | |
This is basically KDAbstractProxyModel, but only the bits that we really need from it. | |
QModelIndex | index (int row, int col, const QModelIndex &index) const |
QModelIndex | mapFromSource (const QModelIndex &sourceIndex) const |
QModelIndex | mapToSource (const QModelIndex &proxyIndex) const |
QModelIndex | parent (const QModelIndex &index) const |
|
This is basically KDAbstractProxyModel, but only the bits that we really need from it.
Definition at line 12 of file KDChartAbstractProxyModel.cpp.
00013 : QAbstractProxyModel(parent) {} |
|
Definition at line 53 of file KDChartAbstractProxyModel.cpp. References mapFromSource(), and mapToSource(). Referenced by KDChart::AttributesModel::setHeaderData(), and KDChart::AttributesModel::setModelData().
00054 { 00055 Q_ASSERT(sourceModel()); 00056 return mapFromSource(sourceModel()->index( row, col, mapToSource(index) )); 00057 } |
|
Definition at line 23 of file KDChartAbstractProxyModel.cpp. Referenced by index(), and parent().
00024 { 00025 if ( !sourceIndex.isValid() ) 00026 return QModelIndex(); 00027 //qDebug() << "sourceIndex.model()="<<sourceIndex.model(); 00028 //qDebug() << "model()="<<sourceModel(); 00029 Q_ASSERT( sourceIndex.model() == sourceModel() ); 00030 00031 // Create an index that preserves the internal pointer from the source; 00032 // this way AbstractProxyModel preserves the structure of the source model 00033 return createIndex( sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer() ); 00034 } |
|
Definition at line 36 of file KDChartAbstractProxyModel.cpp. Referenced by KDChart::AttributesModel::columnCount(), KDChart::AttributesModel::data(), index(), parent(), KDChart::AttributesModel::rowCount(), and KDChart::AttributesModel::setData().
00037 { 00038 if ( !proxyIndex.isValid() ) 00039 return QModelIndex(); 00040 Q_ASSERT( proxyIndex.model() == this ); 00041 // So here we need to create a source index which holds that internal pointer. 00042 // No way to pass it to sourceModel()->index... so we have to do the ugly way: 00043 QModelIndex sourceIndex; 00044 KDPrivateModelIndex* hack = reinterpret_cast<KDPrivateModelIndex*>(&sourceIndex); 00045 hack->r = proxyIndex.row(); 00046 hack->c = proxyIndex.column(); 00047 hack->p = proxyIndex.internalPointer(); 00048 hack->m = sourceModel(); 00049 Q_ASSERT( sourceIndex.isValid() ); 00050 return sourceIndex; 00051 } |
|
Definition at line 59 of file KDChartAbstractProxyModel.cpp. References mapFromSource(), and mapToSource().
00060 { 00061 Q_ASSERT(sourceModel()); 00062 return mapFromSource(sourceModel()->parent( mapToSource(index) )); 00063 } |