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