[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kchart
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2009-12-11 8:00:06
Message-ID: 1260518406.477132.26301.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1061247 by rempt:

KChart: warnings--

 M  +2 -1      KChartCanvas.cpp  
 M  +1 -1      KChartCanvas.h  
 M  +10 -10    shape/Axis.cpp  
 M  +66 -0     shape/CellRegion.cpp  
 M  +7 -3      shape/ChartConfigWidget.cpp  
 M  +1 -1      shape/ChartShape.cpp  
 M  +1 -1      shape/Legend.cpp  
 M  +1 -1      shape/Legend.h  
 M  +6 -6      shape/PlotArea.cpp  
 M  +2 -5      shape/PlotArea.h  


--- trunk/koffice/kchart/KChartCanvas.cpp #1061246:1061247
@@ -247,10 +247,11 @@
 
 void KChartCanvas::resizeEvent( QResizeEvent *e )
 {
+    Q_UNUSED(e);
     adjustOrigin();
 }
 
-QVariant KChartCanvas::inputMethodQuery( Qt::InputMethodQuery query )
+QVariant KChartCanvas::inputMethodQuery( Qt::InputMethodQuery query ) const
 {
     return m_toolProxy->inputMethodQuery( query, *( viewConverter() ) );
 }
--- trunk/koffice/kchart/KChartCanvas.h #1061246:1061247
@@ -91,7 +91,7 @@
     void tabletEvent( QTabletEvent *e );
     void wheelEvent( QWheelEvent *e );
     void resizeEvent( QResizeEvent *e );
-    virtual QVariant inputMethodQuery( Qt::InputMethodQuery query );
+    virtual QVariant inputMethodQuery( Qt::InputMethodQuery query ) const;
     virtual void inputMethodEvent( QInputMethodEvent *e );
 
 private:
--- trunk/koffice/kchart/shape/Axis.cpp #1061246:1061247
@@ -293,16 +293,16 @@
     // updated before KDChart is notified about the new model, which
     // ends up in wrong assumptions about the model's size, etc.
 
-    //QObject::connect( model, SIGNAL( modelReset() ), plotArea, SLOT( update() ) );
+    //QObject::connect( model, SIGNAL( modelReset() ), plotArea, SLOT( \
plotAreaUpdate() ) );  
     QObject::connect( model,    SIGNAL( rowsInserted( const QModelIndex&, int, int ) \
                ),
-                      plotArea, SLOT( update() ) );
+                      plotArea, SLOT( plotAreaUpdate() ) );
     QObject::connect( model,    SIGNAL( rowsRemoved( const QModelIndex&, int, int ) \
                ),
-                      plotArea, SLOT( update() ) );
+                      plotArea, SLOT( plotAreaUpdate() ) );
     QObject::connect( model,    SIGNAL( columnsInserted( const QModelIndex&, int, \
                int ) ),
-                      plotArea, SLOT( update() ) );
+                      plotArea, SLOT( plotAreaUpdate() ) );
     QObject::connect( model,    SIGNAL( columnsRemoved( const QModelIndex&, int, int \
                ) ),
-                      plotArea, SLOT( update() ) );
+                      plotArea, SLOT( plotAreaUpdate() ) );
     
     QObject::connect( plotArea->proxyModel(), SIGNAL( modelReset() ),
                       model,                  SLOT( emitReset() ) );
@@ -313,16 +313,16 @@
 void Axis::Private::deregisterKDChartModel( KDChartModel *model )
 {
     // See comment above about the uncommenting.
-    //QObject::disconnect( model, SIGNAL( modelReset() ), plotArea, SLOT( update() ) \
); +    //QObject::disconnect( model, SIGNAL( modelReset() ), plotArea, SLOT( \
plotAreaUpdate() ) );  
     QObject::disconnect( model,    SIGNAL( rowsInserted( const QModelIndex&, int, \
                int ) ),
-                         plotArea, SLOT( update() ) );
+                         plotArea, SLOT( plotAreaUpdate() ) );
     QObject::disconnect( model,    SIGNAL( rowsRemoved( const QModelIndex&, int, int \
                ) ),
-                         plotArea, SLOT( update() ) );
+                         plotArea, SLOT( plotAreaUpdate() ) );
     QObject::disconnect( model,    SIGNAL( columnsInserted( const QModelIndex&, int, \
                int ) ), 
-                         plotArea, SLOT( update() ) );
+                         plotArea, SLOT( plotAreaUpdate() ) );
     QObject::disconnect( model,    SIGNAL( columnsRemoved( const QModelIndex&, int, \
                int ) ), 
-                         plotArea, SLOT( update() ) );
+                         plotArea, SLOT( plotAreaUpdate() ) );
     
     QObject::disconnect( plotArea->proxyModel(), SIGNAL( modelReset() ),
                          model,                  SLOT( emitReset() ) );
--- trunk/koffice/kchart/shape/CellRegion.cpp #1061246:1061247
@@ -355,6 +355,19 @@
     return (c >= 'A' && c <= 'Z') ? (c - 'A' + 1) : -1;
 }
 
+#if 0 // Unused?
+static int rangeStringToInt( const QString &string )
+{
+    int result = 0;
+    const int size = string.size();
+    for ( int i = 0; i < size; i++ ) {
+        //kDebug(350001) << "---" << float( rangeCharToInt( string[i].toAscii() ) * \
pow( 10.0, ( size - i - 1 ) ) ); +        result += rangeCharToInt( \
string[i].toAscii() ) * pow( 10.0, ( size - i - 1 ) ); +    }
+    //kDebug(350001) << "+++++ result=" << result;
+    return result;
+}
+
 static QString rangeIntToString( int i )
 {
     QString tmp = QString::number( i );
@@ -365,8 +378,61 @@
     //kDebug(350001) << "tmp=" << tmp;
     return tmp;
 }
+#endif
+// static
+QVector<QRect> CellRegion::stringToRegion( const QString &string )
+{
+    if ( string.isEmpty() )
+        return QVector<QRect>();
+    
+    const bool isPoint = !string.contains( ':' );
+    //kDebug(350001) << "CellRegion::stringToRegion():" << string;
+    QString s = string;
+    QStringList regionStrings = isPoint ? s.split( '.' ) : s.remove( ':' ).split( \
'.' ); +    QPoint topLeftPoint;
+    QPoint bottomRightPoint;
 
+    if ( ( isPoint && regionStrings.size() < 2 )
+         || ( !isPoint && regionStrings.size() < 3 ) )
+    {
+        qWarning() << "1) CellRegion::stringToRegion(): Invalid region string \"" << \
string << "\""; +        return QVector<QRect>();
+    }
 
+    const QString tableName = regionStrings[0];
+
+    const QString topLeft = regionStrings[1];
+    QStringList l = topLeft.split( '$' );
+    if ( l.size() < 3 ) {
+        //kDebug(350001) << topLeft;
+        qWarning() << "2) CellRegion::stringToRegion(): Invalid region string \"" << \
string << "\""; +        return QVector<QRect>();
+    }
+
+    int column = rangeStringToInt( l[1] );
+    int row = l[2].toInt() - 1;
+    topLeftPoint = QPoint( column, row );
+
+    if ( isPoint ) {
+        //kDebug(350001) << "Returning" << QVector<QRect>( 1, QRect( topLeftPoint, \
QSize( 1, 1 ) ) ); +        return QVector<QRect>( 1, QRect( topLeftPoint, QSize( 1, \
1 ) ) ); +    }
+
+    const QString bottomRight = regionStrings[2];
+    l = bottomRight.split( '$' );
+    if ( l.size() < 3 ) {
+        qWarning() << "CellRegion::stringToRegion(): Invalid region string \"" << \
string << "\""; +        return QVector<QRect>();
+    }
+    column = rangeStringToInt( l[1] );
+    row = l[2].toInt() - 1;
+    bottomRightPoint = QPoint( column, row );
+
+    //kDebug(350001) << "///" << QRect( topLeftPoint, bottomRightPoint );
+
+    return QVector<QRect>( 1, QRect( topLeftPoint, bottomRightPoint ) );
+}
+
 int CellRegion::rangeCharToInt( char c )     
 {   
     return (c >= 'A' && c <= 'Z') ? (c - 'A' + 1) : -1;     
--- trunk/koffice/kchart/shape/ChartConfigWidget.cpp #1061246:1061247
@@ -167,10 +167,10 @@
 
 
 ChartConfigWidget::Private::Private( QWidget *parent )
-    : newAxisDialog( parent )
+    : tableEditorDialog( 0 )
+    , newAxisDialog( parent )
     , axisScalingDialog( parent )
     , cellRegionDialog( parent )
-    , tableEditorDialog( 0 )
       
 {
     lastHorizontalAlignment = 1; // Qt::AlignCenter
@@ -479,7 +479,7 @@
 void ChartConfigWidget::chartTypeSelected( QAction *action )
 {
     ChartType     type = LastChartType;
-    ChartSubtype  subtype = NoChartSubtype  ;
+    ChartSubtype  subtype = NoChartSubtype;
     
     if ( action == d->normalBarChartAction ) {
         type    = BarChartType;
@@ -1035,6 +1035,7 @@
 
 void ChartConfigWidget::setLegendOrientation( int boxEntryIndex )
 {
+    Q_UNUSED(boxEntryIndex);
     //emit legendOrientationChanged( ( Qt::Orientation ) ( \
d->ui.orientation->itemData( boxEntryIndex ).toInt() ) );  }
 /*
@@ -1051,6 +1052,7 @@
 */
 void ChartConfigWidget::setLegendAlignment( int boxEntryIndex )
 {
+    Q_UNUSED(boxEntryIndex);
     if (    d->fixedPosition == KDChart::Position::North
          || d->fixedPosition == KDChart::Position::South ) {
         //d->lastHorizontalAlignment = d->ui.alignment->currentIndex();
@@ -1063,6 +1065,7 @@
 
 void ChartConfigWidget::setLegendFixedPosition( int buttonGroupIndex )
 {
+    Q_UNUSED(buttonGroupIndex);
     d->lastFixedPosition = d->fixedPosition;
     //d->fixedPosition = buttonIndexToFixedPosition[ buttonGroupIndex ];
     //emit legendFixedPositionChanged( buttonIndexToFixedPosition[ buttonGroupIndex \
] ); @@ -1070,6 +1073,7 @@
 
 void ChartConfigWidget::updateFixedPosition( LegendPosition position )
 {
+    Q_UNUSED(position);
 /*
     if (    position == KDChart::Position::North
          || position == KDChart::Position::South ) {
--- trunk/koffice/kchart/shape/ChartShape.cpp #1061246:1061247
@@ -390,7 +390,7 @@
     // We need this as the very first step, because some methods
     // here rely on the d->plotArea pointer.
     addChild( d->plotArea );
-    d->plotArea->init();
+    d->plotArea->plotAreaInit();
     d->plotArea->setZIndex( 0 );
     setClipping( d->plotArea, true );
 
--- trunk/koffice/kchart/shape/Legend.cpp #1061246:1061247
@@ -570,7 +570,7 @@
     return d->kdLegend;
 }
 
-void Legend::update()
+void Legend::legendUpdate()
 {
     d->pixmapRepaintRequested = true;
     // FIXME: Update legend properly by implementing all *DataChanged() slots
--- trunk/koffice/kchart/shape/Legend.h #1061246:1061247
@@ -74,7 +74,7 @@
     
     KDChart::Legend *kdLegend() const;
     
-    void update();
+    void legendUpdate();
 
 private:
     class Private;
--- trunk/koffice/kchart/shape/PlotArea.cpp #1061246:1061247
@@ -181,18 +181,18 @@
     connect( d->shape->proxyModel(), SIGNAL( modelReset() ),
              this,                   SLOT( dataSetCountChanged() ) );
     connect( d->shape->proxyModel(), SIGNAL( modelResetComplete() ),
-             this,                   SLOT( update() ) );
+             this,                   SLOT( plotAreaUpdate() ) );
     // FIXME: The following signatures don't match.  Bug?
     connect( d->shape->proxyModel(), SIGNAL( rowsInserted( const QModelIndex, int, \
int ) ),  this,                   SLOT( dataSetCountChanged() ) );
     connect( d->shape->proxyModel(), SIGNAL( rowsRemoved( const QModelIndex, int, \
int ) ),  this,                   SLOT( dataSetCountChanged() ) );
     connect( d->shape->proxyModel(), SIGNAL( columnsInserted( const QModelIndex, \
                int, int ) ),
-             this,                   SLOT( update() ) );
+             this,                   SLOT( plotAreaUpdate() ) );
     connect( d->shape->proxyModel(), SIGNAL( columnsRemoved( const QModelIndex, int, \
                int ) ),
-             this,                   SLOT( update() ) );
+             this,                   SLOT( plotAreaUpdate() ) );
     connect( d->shape->proxyModel(), SIGNAL( dataChanged() ),
-             this,                   SLOT( update() ) );
+             this,                   SLOT( plotAreaUpdate() ) );
 }
 
 PlotArea::~PlotArea()
@@ -201,7 +201,7 @@
 }
 
 
-void PlotArea::init()
+void PlotArea::plotAreaInit()
 {
     d->kdChart->resize( size().toSize() );
     d->kdChart->replaceCoordinatePlane( d->kdPlane );
@@ -840,7 +840,7 @@
     return true;
 }
 
-void PlotArea::update() const
+void PlotArea::plotAreaUpdate() const
 {
     parent()->legend()->update();
     requestRepaint();
--- trunk/koffice/kchart/shape/PlotArea.h #1061246:1061247
@@ -55,8 +55,7 @@
     PlotArea( ChartShape *parent );
     ~PlotArea();
     
-    // FIXME: hides the normal KoShape::init()
-    void init();
+    void plotAreaInit();
     
     ChartProxyModel *proxyModel() const;
 
@@ -106,12 +105,10 @@
     
     void relayout() const;
     
-    using KoShape::update;
-
 public slots:
     void requestRepaint() const;
     void dataSetCountChanged();
-    void update() const;
+    void plotAreaUpdate() const;
     
 signals:
     void gapBetweenBarsChanged( int );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic