summaryrefslogtreecommitdiffstats
path: root/libkdchart/KDChartLinesPainter.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
commitfecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch)
tree6b8614802f0d01b353bc9ba78aff2090846c198e /libkdchart/KDChartLinesPainter.cpp
parentdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff)
downloadkmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz
kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdchart/KDChartLinesPainter.cpp')
-rw-r--r--libkdchart/KDChartLinesPainter.cpp127
1 files changed, 62 insertions, 65 deletions
diff --git a/libkdchart/KDChartLinesPainter.cpp b/libkdchart/KDChartLinesPainter.cpp
index 8b80341..aef52b7 100644
--- a/libkdchart/KDChartLinesPainter.cpp
+++ b/libkdchart/KDChartLinesPainter.cpp
@@ -30,12 +30,12 @@
#include <KDChartParams.h>
#include <KDChartPropertySet.h>
-#include <qpainter.h>
+#include <tqpainter.h>
-#if COMPAT_QT_VERSION >= 0x030000
-#include <qvaluevector.h>
+#if COMPAT_TQT_VERSION >= 0x030000
+#include <tqvaluevector.h>
#else
-#include <qarray.h>
+#include <tqarray.h>
#endif
#include <stdlib.h>
@@ -56,7 +56,7 @@ KDChartLinesPainter::KDChartLinesPainter( 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.
}
@@ -73,13 +73,13 @@ KDChartLinesPainter::~KDChartLinesPainter()
Paints the actual data area. Data regions will only be added if \a
regions is not 0.
- \param painter the QPainter onto which the chart should be painted
+ \param painter the TQPainter onto which the chart should be painted
\param data the data that will be displayed as a chart
\param paint2nd specifies whether the main chart or the additional chart is to be drawn now
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartLinesPainter::paintData( QPainter* painter,
+void KDChartLinesPainter::paintData( TQPainter* painter,
KDChartTableDataBase* data,
bool paint2nd,
KDChartDataRegionList* regions )
@@ -100,7 +100,7 @@ void KDChartLinesPainter::paintData( QPainter* painter,
KDChartLinesPainter::paintData() and
KDChartAreaPainter::paintData().
- \param painter the QPainter onto which the chart should be painted
+ \param painter the TQPainter onto which the chart should be painted
\param data the data that will be displayed as a chart
\param centerThePoints if true, the value points will be centered in
their segment (typically used for line charts), if false, the first
@@ -112,7 +112,7 @@ void KDChartLinesPainter::paintData( QPainter* painter,
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartLinesPainter::paintDataInternal( QPainter* painter,
+void KDChartLinesPainter::paintDataInternal( TQPainter* painter,
KDChartTableDataBase* data,
bool centerThePoints,
bool drawMarkers,
@@ -137,12 +137,12 @@ void KDChartLinesPainter::paintDataInternal( QPainter* painter,
into a point onto a plane, given two rotation angles around the x
resp. y axis.
*/
-QPoint KDChartLinesPainter::project( int x, int y, int z )
+TQPoint KDChartLinesPainter::project( int x, int y, int z )
{
double xrad = DEGTORAD( params()->threeDLineXRotation() );
double yrad = DEGTORAD( params()->threeDLineYRotation() );
- QPoint ret( static_cast<int>( x*cos( yrad ) + z * sin( yrad ) ),
+ TQPoint ret( static_cast<int>( x*cos( yrad ) + z * sin( yrad ) ),
static_cast<int>( y*cos( xrad ) - z * sin( xrad ) ) );
return ret;
}
@@ -171,15 +171,15 @@ public:
void setSkipThis( bool skipThis ) {
bSkipThis = skipThis;
}
- QPoint p;
+ TQPoint p;
bool bValid;
bool bSkipThis;
double cellValue;
};
-void KDChartLinesPainter::specificPaintData( QPainter* painter,
- const QRect& /*ourClipRect*/,
+void KDChartLinesPainter::specificPaintData( TQPainter* painter,
+ const TQRect& /*ourClipRect*/,
KDChartTableDataBase* data,
KDChartDataRegionList* regions,
const KDChartAxisParams* ordinatePara,
@@ -248,14 +248,14 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
qDebug( "Internal error in KDChartLinesPainter::paintDataInternal(): Unknown subtype" );
- QMap < int, double > currentValueSums;
+ TQMap < int, double > currentValueSums;
if ( mode == Stacked || mode == Percent ) {
// this array is only used for stacked and percent lines, no need
// to waste time initializing it for normal types
for ( int value = 0; value < ai.numValues; ++value )
currentValueSums[ value ] = 0.0;
}
- QMap < int, double > totalValueSums;
+ TQMap < int, double > totalValueSums;
// compute the position of the 0 axis
double zeroXAxisI;
@@ -286,10 +286,10 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
( dataset >= static_cast < int > ( datasetStart ) && dataset >= 0 );
--dataset )
++arrayNumDatasets;
-#if COMPAT_QT_VERSION >= 0x030000
- QValueVector<MyPoint> allPoints(
+#if COMPAT_TQT_VERSION >= 0x030000
+ TQValueVector<MyPoint> allPoints(
#else
- QArray<MyPoint> allPoints(
+ TQArray<MyPoint> allPoints(
#endif
arrayNumDatasets * arrayNumValues );
@@ -303,7 +303,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
const KDChartParams::LineMarkerStyle
defaultMarkerStyle = params()->lineMarkerStyle( dataset );
- const QPen default2DPen( params()->lineColor().isValid()
+ const TQPen default2DPen( params()->lineColor().isValid()
? params()->lineColor()
: params()->dataColor( dataset ),
params()->lineWidth(),
@@ -312,8 +312,8 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
if( ai.bAbscissaHasTrueAxisDtValues )
ai.numValues = data->cols();
- QVariant vValY;
- QVariant vValX;
+ TQVariant vValY;
+ TQVariant vValX;
int cellPropID;
for( int value = 0; value < ai.numValues; ++value ) {
//if ( mode == Percent )
@@ -326,14 +326,14 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
dataset2 <= datasetEnd;
++dataset2 ) {
if( data->cellCoord( dataset2, value, vValY, 1 ) &&
- QVariant::Double == vValY.type() )
+ TQVariant::Double == vValY.type() )
valueTotal += vValY.toDouble();
}
}
if( data->cellContent( dataset, value, vValY, vValX, cellPropID ) &&
- QVariant::Double == vValY.type() &&
- ( !ai.bCellsHaveSeveralCoordinates || QVariant::Invalid != vValX.type() ) ){
+ TQVariant::Double == vValY.type() &&
+ ( !ai.bCellsHaveSeveralCoordinates || TQVariant::Invalid != vValX.type() ) ){
//qDebug("a. cellPropID: %i",cellPropID);
// calculate Ordinate axis value
@@ -375,9 +375,9 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
// prevent the point from being toooo far
// below the bottom (or above the top, resp.)
// of the cliprect
- double pY = QMIN( zeroXAxisI - drawValue,
+ double pY = TQMIN( zeroXAxisI - drawValue,
(logHeight + axisYOffset) * 3 );
- pY = QMAX( pY, -(logHeight + axisYOffset) * 3 );
+ pY = TQMAX( pY, -(logHeight + axisYOffset) * 3 );
// specify the Point
int myPointX = static_cast < int > ( xValue ) + xShift;
int myPointY = static_cast < int > ( pY );
@@ -448,7 +448,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
- QPointArray previousPoints; // no vector since only areas need it,
+ TQPointArray previousPoints; // no vector since only areas need it,
// and these do not support 3d yet
// Store some (dataset-independend) default values
@@ -463,7 +463,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
// to be used unless other properties
// have been specified for the respective data cell:
//
- const QPen default2DPen( params()->lineColor().isValid()
+ const TQPen default2DPen( params()->lineColor().isValid()
? params()->lineColor()
: params()->dataColor( dataset ),
params()->lineWidth(),
@@ -472,18 +472,18 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
const KDChartParams::LineMarkerStyle markerStyle = params()->lineMarkerStyle( dataset );
// the +2 is for the areas (if any)
- QPtrVector< QPointArray > points( 2 );
+ TQPtrVector< TQPointArray > points( 2 );
points.setAutoDelete( true );
/* Pending Michel - we need to keep track of the
* non rotated points for 3D lines
*/
- QPtrVector< QPointArray > oripoints( 2 );
+ TQPtrVector< TQPointArray > oripoints( 2 );
oripoints.setAutoDelete( true );
int i = 0;
for( i = 0; i < 2; ++i ) {
- points.insert( i, new QPointArray( ai.numValues + 2 ) );
- oripoints.insert( i, new QPointArray( ai.numValues + 2 ) );
+ points.insert( i, new TQPointArray( ai.numValues + 2 ) );
+ oripoints.insert( i, new TQPointArray( ai.numValues + 2 ) );
}
if( ai.bAbscissaHasTrueAxisDtValues )
@@ -509,7 +509,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
if( curPropSetId != KDChartPropertySet::UndefinedID ){
// we can safely call the following functions and ignore their
// return values since they will touch the parameters' values
- // if the propSet *contains* corresponding own values only.
+ // if the propSet *tqcontains* corresponding own values only.
int iDummy;
curPropSet.hasOwnShowMarker( iDummy, currentDrawMarkers );
}
@@ -539,27 +539,27 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
++point;
int x = mp.p.x();
- int y = QMAX(QMIN(mp.p.y(),
+ int y = TQMAX(TQMIN(mp.p.y(),
static_cast < int > (logHeight +axisYOffset)),
0);
bool markerIsOutside = y != mp.p.y();
// draw the marker and store the region
if ( currentDrawMarkers ){
- uint theAlignment = Qt::AlignCenter;
+ uint theAlignment = TQt::AlignCenter;
bool hasOwnSize = false;
int theWidth = 0;
int theHeight = 0;
- QColor theColor(params()->dataColor( dataset ));
+ TQColor theColor(params()->dataColor( dataset ));
int theStyle = markerStyle;
if( curPropSetId != KDChartPropertySet::UndefinedID ){
// we can safely call the following functions and ignore their
// return values since they will touch the parameters' values
- // if the propSet *contains* corresponding own values only.
+ // if the propSet *tqcontains* corresponding own values only.
int iDummy;
curPropSet.hasOwnMarkerAlign( iDummy, theAlignment );
curPropSet.hasOwnMarkerColor( iDummy, theColor );
curPropSet.hasOwnMarkerStyle( iDummy, theStyle );
- QSize size(theWidth, theHeight);
+ TQSize size(theWidth, theHeight);
hasOwnSize = curPropSet.hasOwnMarkerSize(iDummy, size);
if( hasOwnSize ){
theWidth = size.width();
@@ -576,7 +576,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
? KDChartParams::LineMarker1Pixel
: theStyle,
theColor,
- QPoint(x,y),
+ TQPoint(x,y),
dataset, value, chart, regions,
hasOwnSize ? &theWidth : 0,
hasOwnSize ? &theHeight : 0,
@@ -585,10 +585,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
}
// store the region
else if( regions ) {
- QRect rect(
- QPoint( x-params()->lineWidth()-1, y-params()->lineWidth()-1 ),
- QPoint( x+params()->lineWidth()+1, y+params()->lineWidth()+1 )
- );
+ TQRect rect( TQPoint( x-1, y-1 ), TQPoint( x+1, y+1 ) );
rect.moveBy( _dataRect.x(), _dataRect.y() );
regions->append(
new KDChartDataRegion(dataset, value, chart, rect) );
@@ -604,17 +601,17 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
// zero axis points or upper border points added for the first
// dataset or with the previous points reversed for all other
// datasets.
- painter->setPen( QPen( Qt::NoPen ) );
- const QBrush datasetBrush( params()->dataColor( dataset ), Qt::SolidPattern );
+ painter->setPen( TQPen( TQt::NoPen ) );
+ const TQBrush datasetBrush( params()->dataColor( dataset ), TQt::SolidPattern );
painter->setBrush( datasetBrush );
- QBrush currentBrush( datasetBrush );
+ TQBrush currentBrush( datasetBrush );
if ( mode == Normal || dataset == (int)datasetEnd ) {
/// first dataset (or any dataset in normal mode, where
/// the datasets overwrite each other)
// no 3d handling for areas yet
- QPoint lastPoint = points[0]->point( point - 1 );
+ TQPoint lastPoint = points[0]->point( point - 1 );
// zeroXAxisI can be too far below the abscissa, but it's
// the only thing we have. Likewise can 0 be too far above
@@ -633,7 +630,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
points[0]->setPoint( point, lastPoint.x(), yCoord );
point++;
- QPoint firstPoint = points[0]->point( 0 );
+ TQPoint firstPoint = points[0]->point( 0 );
points[0]->setPoint( point, firstPoint.x(), yCoord );
point++;
@@ -656,19 +653,19 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
curPropSetId = KDChartPropertySet::UndefinedID;
}
// preset with default value
- QBrush theAreaBrush = datasetBrush;
+ TQBrush theAreaBrush = datasetBrush;
if( curPropSetId != KDChartPropertySet::UndefinedID ){
// we can safely call the following functions and ignore their
// return values since they will touch the parameters' values
- // if the propSet *contains* corresponding own values only.
+ // if the propSet *tqcontains* corresponding own values only.
int iDummy;
curPropSet.hasOwnAreaBrush( iDummy, theAreaBrush );
}
painter->setBrush( theAreaBrush );
}
- QPointArray segment( 4 );
+ TQPointArray segment( 4 );
segment.setPoint( 0, points[0]->point( value ) );
segment.setPoint( 1, points[0]->point( value+1 ) );
segment.setPoint( 2, points[0]->point( value+1 ).x(), yCoord );
@@ -689,7 +686,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
//qDebug("222");
// no 3d handling for areas yet
- QPointArray thisSection = points[0]->copy();
+ TQPointArray thisSection = points[0]->copy();
thisSection.resize( point + previousPoints.size() );
// append the previous array (there is guaranteed to be
@@ -704,8 +701,8 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
painter->drawPolygon( thisSection );
}
// draw the line with no brush and outline color
- painter->setBrush( Qt::NoBrush );
- painter->setPen( QPen( params()->outlineDataColor(),
+ painter->setBrush( TQt::NoBrush );
+ painter->setPen( TQPen( params()->outlineDataColor(),
params()->outlineDataLineWidth() ) );
} else {
// line
@@ -714,13 +711,13 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
// We draw the line with the data color brush
// and the outline data pen.
painter->setBrush( params()->dataColor( dataset ) );
- painter->setPen( QPen( params()->outlineDataColor(),
+ painter->setPen( TQPen( params()->outlineDataColor(),
params()->outlineDataLineWidth() ) );
} else {
// This is a 2D line:
// We draw the line with the no brush
// and the data color if no special line color was specified.
- painter->setBrush( Qt::NoBrush );
+ painter->setBrush( TQt::NoBrush );
painter->setPen( default2DPen );
}
}
@@ -739,14 +736,14 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
// qDebug( "Draw a segment in dataset %d from %d to %d", dataset, value, value+1 );
//store the rotated points ( see project() )
- QPointArray rotatedSegment( 4 );
+ TQPointArray rotatedSegment( 4 );
rotatedSegment.setPoint( 0, points[0]->point( value ));
rotatedSegment.setPoint( 1, points[0]->point( value+1 ) );
rotatedSegment.setPoint( 2, points[1]->point( value+1 ) );
rotatedSegment.setPoint( 3, points[1]->point( value ) );
//store the true points without rotation
- QPointArray trueSegment( 4 );
+ TQPointArray trueSegment( 4 );
trueSegment.setPoint( 0, oripoints[0]->point( value ));
trueSegment.setPoint( 1, oripoints[0]->point( value+1 ) );
trueSegment.setPoint( 2, oripoints[1]->point( value+1 ) );
@@ -763,7 +760,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
int dy12 = rotatedSegment.point(2).y() - rotatedSegment.point(1).y();
// store and paint the "3D" segment
- QPointArray segment( 4 );
+ TQPointArray segment( 4 );
segment.setPoint( 0, trueSegment.point(0) );
segment.setPoint( 1, trueSegment.point(1) );
segment.setPoint( 2, trueSegment.point(1).x() + dx12, trueSegment.point(1).y() + dy12 );
@@ -778,7 +775,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
// qDebug( "Can't draw a segment in dataset %d from %d to %d", dataset, value, value+1 );
}
} else {
- QPoint p1, p2;
+ TQPoint p1, p2;
// Note: If markers are drawn very near to each other
// and tiny markers are used
// we don't draw the connecting lines.
@@ -806,19 +803,19 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
}
// preset with default values
int theLineWidth = default2DPen.width();
- QColor theLineColor = default2DPen.color();
+ TQColor theLineColor = default2DPen.color();
Qt::PenStyle theLineStyle = default2DPen.style();
if( curPropSetId != KDChartPropertySet::UndefinedID ){
// we can safely call the following functions and ignore their
// return values since they will touch the parameters' values
- // if the propSet *contains* corresponding own values only.
+ // if the propSet *tqcontains* corresponding own values only.
int iDummy;
curPropSet.hasOwnLineWidth ( iDummy, theLineWidth );
curPropSet.hasOwnLineColor ( iDummy, theLineColor );
curPropSet.hasOwnLineStyle ( iDummy, theLineStyle );
curPropSet.hasOwnShowMarker( iDummy, currentDrawMarkers );
}
- painter->setPen( QPen( theLineColor,
+ painter->setPen( TQPen( theLineColor,
theLineWidth,
theLineStyle ) );
}
@@ -893,7 +890,7 @@ void KDChartLinesPainter::specificPaintData( QPainter* painter,
const KDChartParams::LineMarkerStyle
defaultMarkerStyle = params()->lineMarkerStyle( dataset );
- const QPen default2DPen( params()->lineColor().isValid()
+ const TQPen default2DPen( params()->lineColor().isValid()
? params()->lineColor()
: params()->dataColor( dataset ),
params()->lineWidth(),