00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "KDChartModelDataCache_p.h"
00024
00025 #include <limits>
00026
00027 using namespace KDChart::ModelDataCachePrivate;
00028
00029 ModelSignalMapperConnector::ModelSignalMapperConnector( ModelSignalMapper& mapper )
00030 : QObject( 0 ),
00031 m_mapper( mapper )
00032 {
00033 }
00034
00035 ModelSignalMapperConnector::~ModelSignalMapperConnector()
00036 {
00037 }
00038
00039 void ModelSignalMapperConnector::connectSignals( QAbstractItemModel* model )
00040 {
00041 connect( model, SIGNAL( destroyed() ), this, SLOT( resetModel() ) );
00042 connect( model, SIGNAL( columnsInserted( QModelIndex, int, int ) ), this, SLOT( columnsInserted( QModelIndex, int, int ) ) );
00043 connect( model, SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( columnsRemoved( QModelIndex, int, int ) ) );
00044 connect( model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) );
00045 connect( model, SIGNAL( layoutChanged() ), this, SLOT( layoutChanged() ) );
00046 connect( model, SIGNAL( modelReset() ), this, SLOT( modelReset() ) );
00047 connect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInserted( QModelIndex, int, int )) );
00048 connect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( rowsRemoved( QModelIndex, int, int ) ) );
00049 }
00050
00051 void ModelSignalMapperConnector::disconnectSignals( QAbstractItemModel* model )
00052 {
00053 disconnect( model, SIGNAL( destroyed() ), this, SLOT( resetModel() ) );
00054 disconnect( model, SIGNAL( columnsInserted( QModelIndex, int, int ) ), this, SLOT( columnsInserted( QModelIndex, int, int ) ) );
00055 disconnect( model, SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( columnsRemoved( QModelIndex, int, int ) ) );
00056 disconnect( model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) );
00057 disconnect( model, SIGNAL( layoutChanged() ), this, SLOT( layoutChanged() ) );
00058 disconnect( model, SIGNAL( modelReset() ), this, SLOT( modelReset() ) );
00059 disconnect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInserted( QModelIndex, int, int )) );
00060 disconnect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( rowsRemoved( QModelIndex, int, int ) ) );
00061 }
00062
00063 void ModelSignalMapperConnector::resetModel()
00064 {
00065 m_mapper.resetModel();
00066 }
00067
00068 void ModelSignalMapperConnector::columnsInserted( const QModelIndex& parent, int start, int end )
00069 {
00070 m_mapper.columnsInserted( parent, start, end );
00071 }
00072
00073 void ModelSignalMapperConnector::columnsRemoved( const QModelIndex& parent, int start, int end )
00074 {
00075 m_mapper.columnsRemoved( parent, start, end );
00076 }
00077
00078 void ModelSignalMapperConnector::dataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight )
00079 {
00080 m_mapper.dataChanged( topLeft, bottomRight );
00081 }
00082
00083 void ModelSignalMapperConnector::layoutChanged()
00084 {
00085 m_mapper.layoutChanged();
00086 }
00087
00088 void ModelSignalMapperConnector::modelReset()
00089 {
00090 m_mapper.modelReset();
00091 }
00092
00093 void ModelSignalMapperConnector::rowsInserted( const QModelIndex& parent, int start, int end )
00094 {
00095 m_mapper.rowsInserted( parent, start, end );
00096 }
00097
00098 void ModelSignalMapperConnector::rowsRemoved( const QModelIndex& parent, int start, int end )
00099 {
00100 m_mapper.rowsRemoved( parent, start, end );
00101 }