summaryrefslogtreecommitdiffstats
path: root/kchart/kdchart/KDChartBWPainter.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kchart/kdchart/KDChartBWPainter.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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/KDChartBWPainter.cpp')
-rw-r--r--kchart/kdchart/KDChartBWPainter.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/kchart/kdchart/KDChartBWPainter.cpp b/kchart/kdchart/KDChartBWPainter.cpp
index 96bd2bc7..f376403b 100644
--- a/kchart/kdchart/KDChartBWPainter.cpp
+++ b/kchart/kdchart/KDChartBWPainter.cpp
@@ -30,12 +30,12 @@
#include <KDChartParams.h>
#include "KDChartTextPiece.h"
-#include <qpainter.h>
-#if COMPAT_QT_VERSION >= 0x030000
-#include <qmemarray.h>
+#include <tqpainter.h>
+#if COMPAT_TQT_VERSION >= 0x030000
+#include <tqmemarray.h>
#else
-#include <qarray.h>
-#define QMemArray QArray
+#include <tqarray.h>
+#define TQMemArray TQArray
#endif
#include <stdlib.h>
@@ -55,7 +55,7 @@
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.
}
@@ -68,7 +68,7 @@ KDChartBWPainter::~KDChartBWPainter()
}
-void quicksort( QMemArray<double>& a, int lo, int hi )
+void quicksort( TQMemArray<double>& a, int lo, int hi )
{
int i=lo, j=hi;
double h;
@@ -94,13 +94,13 @@ int KDChartBWPainter::calculateStats( KDChartTableDataBase& data,
{
const uint nMax = data.usedCols();
int nUsed = 0;
- QMemArray<double> values( nMax );
+ TQMemArray<double> values( nMax );
double sum = 0.0;
- QVariant vVal;
+ TQVariant vVal;
if( data.sorted() ){
for( uint i=0; i<nMax; ++i){
if( data.cellCoord( dataset, i, vVal, 1 ) &&
- QVariant::Double == vVal.type() ) {
+ TQVariant::Double == vVal.type() ) {
values[nUsed] = vVal.toDouble();
sum += values[nUsed];
++nUsed;
@@ -112,7 +112,7 @@ int KDChartBWPainter::calculateStats( KDChartTableDataBase& data,
double last = 0.0; // <-- avoids an annoying compile-time warning
for( uint i=0; i<nMax; ++i){
if( data.cellCoord( dataset, i, vVal, 1 ) &&
- QVariant::Double == vVal.type() ) {
+ TQVariant::Double == vVal.type() ) {
values[nUsed] = vVal.toDouble();
if( nUsed // skip 1st value
&& last > values[nUsed] )
@@ -145,17 +145,17 @@ int KDChartBWPainter::calculateStats( KDChartTableDataBase& data,
stats[ KDChartParams::Median ] = values[ nUd2 ];
else
stats[ KDChartParams::Median ] =
- (values[ QMAX(nUd2-1, 0) ] + values[ nUd2 ]) /2;
+ (values[ TQMAX(nUd2-1, 0) ] + values[ nUd2 ]) /2;
// find last value of lower quartile
- nLastQ1 = QMAX( nUd2-1, 0 );
- // find 1st value of lower quartile
+ nLastQ1 = TQMAX( nUd2-1, 0 );
+ // tqfind 1st value of lower quartile
nFirstQ1 = nLastQ1 / 2;
// determine how many values are below the median ( == how many are above it)
int nLowerCount = nLastQ1 - nFirstQ1 + 1;
- // find 1st value of upper quartile
- nFirstQ3 = bOdd ? QMIN( nUd2+1, nUsed-1 ) : nUd2;
+ // tqfind 1st value of upper quartile
+ nFirstQ3 = bOdd ? TQMIN( nUd2+1, nUsed-1 ) : nUd2;
// find last value of upper quartile
nLastQ3 = nFirstQ3 + nLowerCount - 1;
@@ -166,16 +166,16 @@ int KDChartBWPainter::calculateStats( KDChartTableDataBase& data,
stats[ KDChartParams::Quartile1 ] = values[ nFirstQ1 ];
else
stats[ KDChartParams::Quartile1 ] =
- (values[ QMAX(nFirstQ1-1, 0) ] + values[ nFirstQ1 ]) /2;
+ (values[ TQMAX(nFirstQ1-1, 0) ] + values[ nFirstQ1 ]) /2;
// find upper quartile
if( bOdd2 ){
stats[ KDChartParams::Quartile3 ] = values[ nLastQ3 ];
}
else{
- //qDebug(" "+QString::number(nLastQ3)+" "+QString::number(KDChartParams::Quartile3)
- // +" "+QString::number(nUsed)+" "+QString::number(QMIN(nLastQ3+1, nUsed-1)));
+ //qDebug(" "+TQString::number(nLastQ3)+" "+TQString::number(KDChartParams::Quartile3)
+ // +" "+TQString::number(nUsed)+" "+TQString::number(TQMIN(nLastQ3+1, nUsed-1)));
stats[ KDChartParams::Quartile3 ] =
- (values[ nLastQ3 ] + values[ QMIN(nLastQ3+1, nUsed-1) ]) /2;
+ (values[ nLastQ3 ] + values[ TQMIN(nLastQ3+1, nUsed-1) ]) /2;
}
// find the interquartile range (IQR)
double iqr = stats[ KDChartParams::Quartile3 ] - stats[ KDChartParams::Quartile1 ];
@@ -210,9 +210,9 @@ int KDChartBWPainter::calculateStats( KDChartTableDataBase& data,
\return the fallback text to use for describing the specified
dataset in the legend
*/
-QString KDChartBWPainter::fallbackLegendText( uint dataset ) const
+TQString KDChartBWPainter::fallbackLegendText( uint dataset ) const
{
- return QObject::tr( "Series " ) + QString::number( dataset + 1 );
+ return TQObject::tr( "Series " ) + TQString::number( dataset + 1 );
}
@@ -245,14 +245,14 @@ int KDChartBWPainter::clipShiftUp( bool, double ) const
Paints the actual data area and registers the region for the data
points 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 KDChartBWPainter::specificPaintData( QPainter* painter,
- const QRect& ourClipRect,
+void KDChartBWPainter::specificPaintData( TQPainter* painter,
+ const TQRect& ourClipRect,
KDChartTableDataBase* data,
KDChartDataRegionList* /*regions*/,
const KDChartAxisParams* axisPara,
@@ -286,12 +286,12 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
// compute the position of the 0 axis
double zeroXAxisI = axisPara->axisZeroLineStartY() - _dataRect.y();
- const int lineWidth = static_cast<int>( pointDist / 66.0 ) * QMAX(params()->lineWidth(), 1);
+ const int lineWidth = static_cast<int>( pointDist / 66.0 ) * TQMAX(params()->lineWidth(), 1);
const int lineWidthD2 = lineWidth * 2 / 3;
- const bool noBrush = Qt::NoBrush == params()->bWChartBrush().style();
+ const bool noBrush = TQt::NoBrush == params()->bWChartBrush().style();
- // Loop over the datasets, draw one box and whisker shape for each series.
+ // Loop over the datasets, draw one box and whisker tqshape for each series.
for ( uint dataset = chartDatasetStart;
dataset <= chartDatasetEnd;
++dataset ) {
@@ -299,7 +299,7 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
if( dataset >= datasetStart &&
dataset <= datasetEnd &&
0 < calculateStats( *data, dataset ) ) {
- const QColor color( params()->dataColor( dataset ) );
+ const TQColor color( params()->dataColor( dataset ) );
// transform calculated values
double drawUOF = stats[ KDChartParams::UpperOuterFence ] * pixelsPerUnit;
double drawUIF = stats[ KDChartParams::UpperInnerFence ] * pixelsPerUnit;
@@ -312,23 +312,23 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
double drawMin = stats[ KDChartParams::MinValue ] * pixelsPerUnit;
double drawMean= stats[ KDChartParams::MeanValue ] * pixelsPerUnit;
// get whisker values
- double drawUWhisker = QMIN(drawUIF, drawMax);
- double drawLWhisker = QMAX(drawLIF, drawMin);
+ double drawUWhisker = TQMIN(drawUIF, drawMax);
+ double drawLWhisker = TQMAX(drawLIF, drawMin);
// get the box width
- const int boxWidth = QMAX( 6, static_cast<int>( pointDist * 0.2 ) );
+ const int boxWidth = TQMAX( 6, static_cast<int>( pointDist * 0.2 ) );
// get marker size (for the outliers and/or for the median value)
int markWidth = params()->bWChartOutValMarkerSize();
bool drawOutliers = ( 0 != markWidth );
if( drawOutliers ){
if( 0 > markWidth)
- markWidth = QMAX( 4, markWidth * boxWidth / -100 );
+ markWidth = TQMAX( 4, markWidth * boxWidth / -100 );
else
- markWidth = QMAX( 4, markWidth );
+ markWidth = TQMAX( 4, markWidth );
}
else
markWidth = boxWidth * 25 / 100; // use the default for the Median marker
- painter->setPen( QPen( color, lineWidth ) );
+ painter->setPen( TQPen( color, lineWidth ) );
painter->setBrush( params()->bWChartBrush() );
// draw the box
int boxWidthD2 = boxWidth / 2;
@@ -365,39 +365,39 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
int xPos2 = static_cast<int>(
pointDist * ( (double)(dataset - chartDatasetStart) + 0.5 )
- lineWidthD2 / 2);
- int markWidthD2 = QMAX(markWidth / 2, 2);
- int markWidthD25 = QMAX(static_cast<int>( 0.85 * markWidth / 2.0), 2);
- int markWidthD35 = QMAX(static_cast<int>( 0.85 * markWidth / 3.0), 2);
+ int markWidthD2 = TQMAX(markWidth / 2, 2);
+ int markWidthD25 = TQMAX(static_cast<int>( 0.85 * markWidth / 2.0), 2);
+ int markWidthD35 = TQMAX(static_cast<int>( 0.85 * markWidth / 3.0), 2);
// draw the outliers
if( drawOutliers ){
const uint nMax = data->usedCols();
int drawVal;
- QVariant vVal;
+ TQVariant vVal;
for( uint i=0; i<nMax; ++i)
if( data->cellCoord( dataset, i, vVal, 1 ) &&
- QVariant::Double == vVal.type() ) {
+ TQVariant::Double == vVal.type() ) {
drawVal = static_cast<int>( pixelsPerUnit * vVal.toDouble() );
if( drawLOF > drawVal || drawUOF < drawVal ) {
- painter->setPen( Qt::NoPen );
+ painter->setPen( TQt::NoPen );
painter->drawChord( xPos2 - markWidthD2,
static_cast<int>(zeroXAxisI - drawVal) - markWidthD2,
markWidth,
markWidth,
0, 5760 );
- painter->setPen( QPen( color, lineWidthD2 ) );
+ painter->setPen( TQPen( color, lineWidthD2 ) );
painter->drawArc( xPos2 - markWidthD2,
static_cast<int>(zeroXAxisI - drawVal) - markWidthD2,
markWidth,
markWidth,
0, 5760 );
} else if( drawLIF > drawVal || drawUIF < drawVal ) {
- painter->setPen( Qt::NoPen );
+ painter->setPen( TQt::NoPen );
painter->drawChord( xPos2 - markWidthD2,
static_cast<int>( zeroXAxisI - drawVal) - markWidthD2,
markWidth,
markWidth,
0, 5760 );
- painter->setPen( QPen( color, lineWidthD2 ) );
+ painter->setPen( TQPen( color, lineWidthD2 ) );
painter->drawLine( xPos2,
static_cast<int>(zeroXAxisI - drawVal) - markWidthD2,
xPos2,
@@ -425,10 +425,10 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
// use different color brightness for the Mean marker
int h,s,v;
color.hsv(&h,&s,&v);
- painter->setPen( QPen( 128 > v ? color.light(150) : color.dark(150),
+ painter->setPen( TQPen( 128 > v ? color.light(150) : color.dark(150),
lineWidthD2 ) );
} else
- painter->setPen( QPen( color, lineWidthD2 ) );
+ painter->setPen( TQPen( color, lineWidthD2 ) );
painter->drawLine( xPos2 - markWidthD2 - (evenLineWidthD2 ? 0 : 1),
static_cast<int>( zeroXAxisI - drawMean ),
xPos2 + markWidthD2,
@@ -439,13 +439,13 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
static_cast<int>( zeroXAxisI - drawMean ) + markWidthD2 + (evenLineWidthD2 ? 0 : 1) );
// draw the statistical value texts
- painter->setPen( Qt::NoPen );
+ painter->setPen( TQt::NoPen );
for( int ii = KDChartParams::BWStatValSTART;
ii <= KDChartParams::BWStatValEND;
++ii ){
KDChartParams::BWStatVal i = (KDChartParams::BWStatVal)ii;
if( params()->bWChartPrintStatistics( i ) ) {
- QFont statFont( params()->bWChartStatisticsFont( i ) );
+ TQFont statFont( params()->bWChartStatisticsFont( i ) );
float nTxtHeight = statFont.pointSizeFloat();
if ( params()->bWChartStatisticsUseRelSize( i ) ) {
nTxtHeight = params()->bWChartStatisticsFontRelSize( i )
@@ -453,7 +453,7 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
statFont.setPointSizeFloat( nTxtHeight );
}
double drawStat = pixelsPerUnit * stats[i];
- KDChartTextPiece statText( painter, QString::number( stats[i] ),
+ KDChartTextPiece statText( painter, TQString::number( stats[i] ),
statFont );
int tw = statText.width();
int xDelta = ( KDChartParams::MaxValue == i
@@ -461,13 +461,13 @@ void KDChartBWPainter::specificPaintData( QPainter* painter,
|| KDChartParams::MinValue == i )
? -1 * (tw + static_cast<int>( 1.3*boxWidthD2 ))
: static_cast<int>( 1.3*boxWidthD2 );
- QBrush brush( params()->bWChartStatisticsBrush( i ) );
+ TQBrush brush( params()->bWChartStatisticsBrush( i ) );
painter->setBrush( brush );
int y = static_cast<int>( zeroXAxisI - drawStat - nTxtHeight/2);
painter->drawRect( xPos + xDelta - 1,
y,
tw + 2,
- QMAX(static_cast < int > ( nTxtHeight ), 8) + 1 );
+ TQMAX(static_cast < int > ( nTxtHeight ), 8) + 1 );
statText.draw( painter,
xPos + xDelta,
y,