diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kchart/kdchart/KDChartBarPainter.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kchart/kdchart/KDChartBarPainter.cpp')
-rw-r--r-- | kchart/kdchart/KDChartBarPainter.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kchart/kdchart/KDChartBarPainter.cpp b/kchart/kdchart/KDChartBarPainter.cpp index b41fa34e..f8ae89d2 100644 --- a/kchart/kdchart/KDChartBarPainter.cpp +++ b/kchart/kdchart/KDChartBarPainter.cpp @@ -29,7 +29,7 @@ #include "KDChartBarPainter.h" #include <KDChartParams.h> -#include <qpainter.h> +#include <tqpainter.h> #include <stdlib.h> @@ -48,7 +48,7 @@ KDChartBarPainter::KDChartBarPainter( KDChartParams* params ) : KDChartAxesPainter( params ) { // This constructor intentionally left blank so far; we cannot setup the - // geometry yet since we do not know the size of the painter. + // tqgeometry yet since we do not know the size of the painter. } @@ -76,7 +76,7 @@ int KDChartBarPainter::clipShiftUp( bool normalMode, double areaWidthP1000 ) con } -void KDChartBarPainter::initMyPainter( QPainter* painter ) +void KDChartBarPainter::initMyPainter( TQPainter* painter ) { _myPainter = painter; _painterDX = 0.0; @@ -123,16 +123,16 @@ void KDChartBarPainter::calculateXFront1_2( bool bNormalMode, bool bIsVeryFirstB } -QPointArray rectToPointArray( const QRect& r ) +TQPointArray rectToPointArray( const TQRect& r ) { - QPointArray a(4); + TQPointArray a(4); a.putPoints( 0, 4, r.left(),r.top(), r.right(),r.top(), r.right(),r.bottom(), r.left(),r.bottom() ); return a; } -void KDChartBarPainter::specificPaintData( QPainter* painter, - const QRect& ourClipRect, +void KDChartBarPainter::specificPaintData( TQPainter* painter, + const TQRect& ourClipRect, KDChartTableDataBase* data, KDChartDataRegionList* regions, const KDChartAxisParams* ordinatePara, @@ -156,7 +156,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, *Store the painted rectangles in order to paint * *them in relation to each other for more precision. * ****************************************************/ - QRect frontRectPositive,frontRectNegative, + TQRect frontRectPositive,frontRectNegative, rightRectPositive, rightRectNegative, excessRectPositive,excessRectNegative; @@ -166,7 +166,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, if( !data ) return; // qDebug("datasetStart: %i datasetEnd: %i", datasetStart, datasetEnd); - const QPen defaultOutlinePen( params()->outlineDataColor(), + const TQPen defaultOutlinePen( params()->outlineDataColor(), params()->outlineDataLineWidth(), params()->outlineDataLineStyle() ); abscissaInfos ai; @@ -176,7 +176,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, logWidth, _dataRect, ai ); - const QRect devRect( painter->window() ); + const TQRect devRect( painter->window() ); initMyPainter( painter ); @@ -226,7 +226,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, ? 0.0 : static_cast<int>( valueBlockGap ) * numValues; - // Set some geometry values that apply to bar charts only + // Set some tqgeometry values that apply to bar charts only double totalNumberOfBars = 0.0; double spaceBetweenDatasets = 0.0; switch ( params()->barChartSubType() ) { @@ -391,10 +391,10 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, dataset <= datasetEnd; ++dataset ) { - QVariant vVal; + TQVariant vVal; if( data->cellCoord( dataset, value, vVal, 1 ) && params()->chartSourceMode( dataset ) == KDChartParams::DataEntry - && QVariant::Double == vVal.type() ){ + && TQVariant::Double == vVal.type() ){ const double cellValue = ordinateIsLogarithmic @@ -409,8 +409,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, if( 0.0 <= cellValue ) lastValidPositiveValue = dataset; - maxValueInThisColumn = QMAX( maxValueInThisColumn, cellValue ); - minValueInThisColumn = QMIN( minValueInThisColumn, cellValue ); + maxValueInThisColumn = TQMAX( maxValueInThisColumn, cellValue ); + minValueInThisColumn = TQMIN( minValueInThisColumn, cellValue ); if( params()->barChartSubType() == KDChartParams::BarPercent /*|| params()->barChartSubType() == KDChartParams::BarStacked*/ ) valueTotal += cellValue; @@ -437,11 +437,11 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, = (params()->chartSourceMode( dataset ) == KDChartParams::DataEntry); - QVariant coord1; - QVariant coord2; + TQVariant coord1; + TQVariant coord2; int propID; if( data->cellContent( dataset, value, coord1, coord2, propID ) - && QVariant::Double == coord1.type() ){ + && TQVariant::Double == coord1.type() ){ const double cellValue = ordinateIsLogarithmic @@ -458,7 +458,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, barHeight = pixelsPerUnit * cellValue; if( 0.0 <= barHeight ) - //barHeight = QMAX(0.0, barHeight - sideBarHeight); + //barHeight = TQMAX(0.0, barHeight - sideBarHeight); barHeight = barHeight - sideBarHeight; else barHeight -= sideBarHeight; @@ -484,20 +484,20 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, ai, 0, xpos ); // adjust bar position to have it horizontally centered to the point if( ai.bAbscissaHasTrueAxisDtValues && - QVariant::DateTime == coord2.type() ) + TQVariant::DateTime == coord2.type() ) xpos -= frontBarWidth / 2.0; } if( !skipMe ){ // Configure colors - QColor myBarColor( params()->dataColor( dataset ) ); - QColor myShadow1Color( params()->dataShadow1Color( dataset ) ); - QColor myShadow2Color( params()->dataShadow2Color( dataset ) ); + TQColor myBarColor( params()->dataColor( dataset ) ); + TQColor myShadow1Color( params()->dataShadow1Color( dataset ) ); + TQColor myShadow2Color( params()->dataShadow2Color( dataset ) ); // Get default values for extra lines and their markers const KDChartParams::LineMarkerStyle defaultMarkerStyle = params()->lineMarkerStyle( dataset ); - const QPen defaultPen( params()->lineColor().isValid() + const TQPen defaultPen( params()->lineColor().isValid() ? params()->lineColor() : params()->dataColor( dataset ), params()->lineWidth(), @@ -529,7 +529,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, if( !bDrawExtraLines || bCellPropertiesFound ){ - //QRegion* region = 0; + //TQRegion* region = 0; KDChartDataRegion::PointArrayList * pointArrayList = 0; if( bDataEntrySourceMode && !bDrawExtraLines ){ painter->setPen( defaultOutlinePen ); @@ -571,7 +571,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, frontX1, frontX2, prevFrontX2 ); const int xm = static_cast < int > ( (frontX1 + frontX2) / 2.0 ); - QRect rect( ourClipRect ); + TQRect rect( ourClipRect ); rect.setHeight( static_cast<int>( rect.height() + 3.0 * delta ) ); painter->setClipRect( rect ); @@ -579,7 +579,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, //Pending Michel: Make sure the point of the arrow is always at the same distance //from the X axis reference to the point of the arrow. int arrowXAxisGap; - QPoint arrowTop( xm,static_cast<int>( yZero + height1 + 2 * yArrowGap) ); + TQPoint arrowTop( xm,static_cast<int>( yZero + height1 + 2 * yArrowGap) ); if ( arrowTop.y()== yposNegatives ) arrowXAxisGap = -2; @@ -608,7 +608,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, */ // Draw solid excess arrows negatives - QPointArray points( 5 ); + TQPointArray points( 5 ); /*this works in a positive view -> 200 500*/ points.setPoint( 0, frontX1, cellValue < 0 ? static_cast<int>(yZero+height1 - 3.0*delta)+(2*yArrowGap)+ arrowXAxisGap: @@ -670,7 +670,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, else userwidth = static_cast <int> (params()->userWidth() * areaWidthP1000); //if ( userwidth < frontBarWidth ) { - QRect tmpRect ( points.point(0), points.point(2)); + TQRect tmpRect ( points.point(0), points.point(2)); points.setPoint(0, static_cast <int>(tmpRect.center().x() - userwidth/2), points.point(0).y()); points.setPoint(1, static_cast <int>(tmpRect.center().x() + userwidth/2), @@ -685,8 +685,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, painter->drawPolygon( points ); //correct the y position: displaying position for the value label - QPoint tpLeft (points.point(4).x(), points.point(4).y() - 2 * yArrowGap ); - QPoint tpRight(points.point(2).x(), points.point(2).y() - 2 * yArrowGap ); + TQPoint tpLeft (points.point(4).x(), points.point(4).y() - 2 * yArrowGap ); + TQPoint tpRight(points.point(2).x(), points.point(2).y() - 2 * yArrowGap ); //store the front rectangle excessRectNegative.setTopLeft(tpLeft); @@ -719,7 +719,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, * The value is too low because over the Min negative value * The value is not within the configured view.. */ - QPointArray points( 5 ); + TQPointArray points( 5 ); /*this works in a positive view -> 200 500*/ points.setPoint( 0, frontX1, cellValue < 0 ? static_cast<int>(yZero+height1 - 3.0*delta) + arrowXAxisGap: @@ -777,7 +777,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, else userwidth = static_cast <int> (params()->userWidth() * areaWidthP1000); //if ( userwidth < frontBarWidth ) { - QRect tmpRect ( points.point(0), points.point(2)); + TQRect tmpRect ( points.point(0), points.point(2)); points.setPoint(0, static_cast <int>(tmpRect.center().x() - userwidth/2), points.point(0).y()); points.setPoint(1, static_cast <int>(tmpRect.center().x() + userwidth/2), @@ -791,8 +791,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, painter->drawPolygon( points ); //correct the y position: displaying position for the value label - QPoint tpLeft (points.point(4).x(), points.point(4).y() - 2 * yArrowGap ); - QPoint tpRight(points.point(2).x(), points.point(2).y() - 2 * yArrowGap ); + TQPoint tpLeft (points.point(4).x(), points.point(4).y() - 2 * yArrowGap ); + TQPoint tpRight(points.point(2).x(), points.point(2).y() - 2 * yArrowGap ); //store the excess front rectangle excessRectNegative.setTopLeft(tpLeft); @@ -815,7 +815,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, pointArrayList->append( points ); } - QPointArray points2( 6 ); + TQPointArray points2( 6 ); points2.setPoint( 0, frontX1, cellValue < 0 ? static_cast<int>( yZero + height1 - 3.0 * delta ) + arrowXAxisGap: static_cast<int>(yZero + height1) + arrowXAxisGap); @@ -910,7 +910,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, else { // // old code (sometimes not touching the grid): - //QRect rec( xpos, yZero, frontBarWidth, -barHeight ); + //TQRect rec( xpos, yZero, frontBarWidth, -barHeight ); //painter->drawRect( rec ); // @@ -919,8 +919,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, /* if ( cellValue != 0 ) { pt1Y = static_cast <int> (cellValue * pixelsPerUnit * -2); - qDebug( "value %s",QString::number(static_cast <int> (cellValue)).latin1()); - qDebug( "pt1Y %s", QString::number(static_cast <int> (cellValue * pixelsPerUnit * -2)).latin1()); + qDebug( "value %s",TQString::number(static_cast <int> (cellValue)).latin1()); + qDebug( "pt1Y %s", TQString::number(static_cast <int> (cellValue * pixelsPerUnit * -2)).latin1()); } else pt1Y = static_cast < int > ( yZero - barHeight); @@ -929,8 +929,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, xpos, valueBlockGap, datasetGap, frontBarWidth, frontX1, frontX2, prevFrontX2 ); - QPoint pt1( frontX1, pt1Y ); - QPoint pt2( frontX2, + TQPoint pt1( frontX1, pt1Y ); + TQPoint pt2( frontX2, static_cast < int > ( yZero + sideBarHeight) ); if( 0.0 > maxColumnValue ){ @@ -961,14 +961,14 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, bDrawExtraLinesInFront ); }else if( bShowThisBar ){ - QSize siz( pt2.x() - pt1.x(), + TQSize siz( pt2.x() - pt1.x(), pt2.y() - pt1.y() ); - QRect rect( pt1, siz ); + TQRect rect( pt1, siz ); if( 1.5 > frontBarWidth ){ - QPen oldPen( painter->pen() ); - painter->setPen( QPen(painter->brush().color(), 0) ); - painter->drawLine(pt1, QPoint(pt1.x(),pt2.y())); + TQPen oldPen( painter->pen() ); + painter->setPen( TQPen(painter->brush().color(), 0) ); + painter->drawLine(pt1, TQPoint(pt1.x(),pt2.y())); painter->setPen( oldPen ); }else{ // store the front rect negative @@ -1042,9 +1042,9 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, double minDataValueYPos = maxValueYPos - minValueYPos; double yZero = yposPositives - zeroXAxisI; //qDebug( "yposPositives %f - zeroXAxisI %f = %f" , yposPositives, zeroXAxisI, yZero ); - //qDebug( "yZero %s", QString::number( yZero ).latin1()); - //qDebug( "minDataValueYPos = %s", QString::number( minDataValueYPos).latin1()); - //qDebug( "positive value %s", QString::number( cellValue).latin1()); + //qDebug( "yZero %s", TQString::number( yZero ).latin1()); + //qDebug( "minDataValueYPos = %s", TQString::number( minDataValueYPos).latin1()); + //qDebug( "positive value %s", TQString::number( cellValue).latin1()); //Pending Michel: draw the default split excess arrows //when the front top of the 3d chart reach the max Y value @@ -1076,7 +1076,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, frontX1, frontX2, prevFrontX2 ); const int xm = static_cast < int > ( ( frontX1 + frontX2 ) / 2.0 ); - QRect rect( ourClipRect ); + TQRect rect( ourClipRect ); rect.setTop( static_cast<int>( rect.top() + 3 * delta ) ); rect.setHeight( static_cast<int>( rect.height() - 3 * delta ) ); @@ -1097,7 +1097,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, }else if( bShowThisBar ){ if( params()->drawSolidExcessArrows() ) { // Draw solid excess arrows - QPointArray points( 5 ); + TQPointArray points( 5 ); /*this works for positive config and 0 include config*/ points.setPoint( 0, frontX1, (minDataValueYPos < static_cast <int> (yZero))? @@ -1128,7 +1128,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, else userwidth = static_cast <int> (params()->userWidth() * areaWidthP1000); //if ( userwidth < frontBarWidth ) { - QRect tmpRect ( points.point(0), points.point(2)); + TQRect tmpRect ( points.point(0), points.point(2)); points.setPoint(0, static_cast <int>(tmpRect.center().x() - userwidth/2), points.point(0).y()); points.setPoint(1, static_cast <int>(tmpRect.center().x() + userwidth/2), @@ -1146,8 +1146,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, painter->drawPolygon( points ); } //correct the y position: displaying position for the value label - QPoint tpLeft (points.point(4).x(), static_cast <int> (points.point(4).y() - yArrowGap)); - QPoint tpRight(points.point(2).x(), static_cast <int> (points.point(2).y() - yArrowGap)); + TQPoint tpLeft (points.point(4).x(), static_cast <int> (points.point(4).y() - yArrowGap)); + TQPoint tpRight(points.point(2).x(), static_cast <int> (points.point(2).y() - yArrowGap)); //debugging points /* @@ -1184,7 +1184,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, * The value is too high because over the Max positive value * or it is not within the configured view. */ - QPointArray points( 5 ); + TQPointArray points( 5 ); /*this works for positive config and 0 include config*/ points.setPoint( 0, frontX1, (minDataValueYPos < static_cast <int> (yZero))? @@ -1212,7 +1212,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, else userwidth = static_cast <int> (params()->userWidth() * areaWidthP1000); //if ( userwidth < frontBarWidth ) { - QRect tmpRect ( points.point(0), points.point(2)); + TQRect tmpRect ( points.point(0), points.point(2)); points.setPoint(0, static_cast <int>(tmpRect.center().x() - userwidth/2), points.point(0).y()); points.setPoint(1, static_cast <int>(tmpRect.center().x() + userwidth/2), @@ -1250,7 +1250,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, } } - QPointArray points2( 6 ); + TQPointArray points2( 6 ); points2.setPoint( 0, frontX1, static_cast<int>( yZero + height1 - 3.0 * delta ) ); points2.setPoint( 1, xm, static_cast<int>( yZero + height1 ) ); points2.setPoint( 2, frontX2, static_cast<int>( yZero + height1 - 3.0 * delta ) ); @@ -1308,8 +1308,8 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, xpos, valueBlockGap, datasetGap, frontBarWidth, frontX1, frontX2, prevFrontX2 ); - QPoint pt1( frontX1, pt1Y ); - QPoint pt2( frontX2, + TQPoint pt1( frontX1, pt1Y ); + TQPoint pt2( frontX2, static_cast < int > ( y0 + shiftUpperBars ) ); if( 0.0 < minColumnValue ) @@ -1341,10 +1341,10 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, bDrawExtraLinesInFront ); }else if( bShowThisBar ){ - QSize siz( pt2.x() - pt1.x(), + TQSize siz( pt2.x() - pt1.x(), pt2.y() - pt1.y()); - QRect rect( pt1, siz ); + TQRect rect( pt1, siz ); //adjust display for the 3d percent bars - last dataset. if ( params()->barChartSubType() == KDChartParams::BarPercent && cellValue != 0) @@ -1367,14 +1367,14 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, if( 1.5 > frontBarWidth ){ //qDebug("1.5 > frontBarWidth "); - QPen oldPen( painter->pen() ); - painter->setPen( QPen(painter->brush().color(), 0) ); - painter->drawLine(pt1, QPoint(pt1.x(),pt2.y())); + TQPen oldPen( painter->pen() ); + painter->setPen( TQPen(painter->brush().color(), 0) ); + painter->drawLine(pt1, TQPoint(pt1.x(),pt2.y())); painter->setPen( oldPen ); }else{ //debugging points and lines /* - painter->drawText( rect.topLeft(), QString::number(cellValue).latin1()); + painter->drawText( rect.topLeft(), TQString::number(cellValue).latin1()); painter->drawText( rect.topRight(), "1f"); painter->drawText( rect.bottomRight(), "2f"); painter->drawText( rect.bottomLeft(), "3f"); @@ -1422,7 +1422,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, if ( bShowThisBar && _bThreeDBars && !bDrawExtraLines ) { //Pending Michel: no need to use that anymore //const int maxY = 2*devRect.height(); - QPointArray points( 4 ); + TQPointArray points( 4 ); if (cellValue <= 0 || cellValue < minColumnValue) { if ( tooLow || cellValue < minColumnValue ) { points.setPoint(0, excessRectNegative.topRight()); @@ -1472,7 +1472,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, } if ( myShadow2Color.isValid() ) - painter->setBrush( QBrush( myShadow2Color, params()->shadowPattern() ) ); + painter->setBrush( TQBrush( myShadow2Color, params()->shadowPattern() ) ); else painter->setBrush( NoBrush ); @@ -1503,7 +1503,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, // Dont override the region stored in case of excess values or barPercent this in order to display // the value labels closer to the corner of the front bar. if ( pointArrayList && !tooHigh && !tooLow && params()->barChartSubType() != KDChartParams::BarPercent ) { - QPointArray points2cpy( points.copy() ); + TQPointArray points2cpy( points.copy() ); //qDebug("g2"); points2cpy.translate( _dataRect.x(), _dataRect.y()); //qDebug("g3"); @@ -1573,7 +1573,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, if (cellValue < 0.0 && maxValueInThisColumn < 0) painter->setBrush( bMultiRows ? myBarColor : black ); else - painter->setBrush( QBrush( myShadow1Color, params()->shadowPattern() ) ); + painter->setBrush( TQBrush( myShadow1Color, params()->shadowPattern() ) ); if ( !myShadow1Color.isValid() ) painter->setBrush( NoBrush ); // override prev. setting @@ -1613,7 +1613,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, } else { // just store a rectangle if NOT in 3-D bar mode region = new KDChartDataRegion( dataset, value, chart, - pointArrayList->first().boundingRect() ); + TQT_TQRECT_OBJECT(pointArrayList->first().boundingRect()) ); delete pointArrayList; } /*qDebug("KDChartDataRegion stored! x: %i y: %i w: %i h: %i", @@ -1636,7 +1636,7 @@ void KDChartBarPainter::specificPaintData( QPainter* painter, iDummy1, iDummy2, prevFrontX2 ); }// if( dataset >= datasetStart && dataset <= datasetEnd ) - // Vertical advancement in stacked or percent only if there was a value + //Qt::Vertical advancement in stacked or percent only if there was a value // Pending Michel add sideBarHeight in case we are in 3D mode but not for Percent // where we need to display the top rect but cant resize the YAxis. if ( params()->barChartSubType() == KDChartParams::BarStacked || |