From c45ec5d9bde729f8a40f2e59c886c629d2e43a93 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 5 Jun 2023 13:45:55 +0900 Subject: [PATCH] Drop use of COMPAT_TQT_VERSION define Signed-off-by: Michele Calgaro --- libkdchart/KDChartAxesPainter.cpp | 62 +----------------------------- libkdchart/KDChartGlobal.h | 17 -------- libkdchart/KDChartParams.cpp | 6 --- libkdchart/KDChartPiePainter.cpp | 8 +--- libkdchart/KDChartPolarPainter.cpp | 8 +--- libkdchart/KDChartRingPainter.cpp | 8 +--- libkdchart/KDChartTable.h | 7 ---- libkdchart/KDChartVectorSeries.cpp | 10 ----- libkdchart/KDXMLTools.cpp | 8 ---- 9 files changed, 4 insertions(+), 130 deletions(-) diff --git a/libkdchart/KDChartAxesPainter.cpp b/libkdchart/KDChartAxesPainter.cpp index 0f9d43b..094cfd6 100644 --- a/libkdchart/KDChartAxesPainter.cpp +++ b/libkdchart/KDChartAxesPainter.cpp @@ -83,39 +83,6 @@ KDChartAxesPainter::~KDChartAxesPainter() } -#if COMPAT_TQT_VERSION < 0x030000 -TQDateTime dateTimeFromString( const TQString& s ) // only ISODate is allowed -{ - int year( s.mid( 0, 4 ).toInt() ); - int month( s.mid( 5, 2 ).toInt() ); - int day( s.mid( 8, 2 ).toInt() ); - TQString t( s.mid( 11 ) ); - int hour( t.mid( 0, 2 ).toInt() ); - int minute( t.mid( 3, 2 ).toInt() ); - int second( t.mid( 6, 2 ).toInt() ); - int msec( t.mid( 9, 3 ).toInt() ); - if ( year && month && day ) - return TQDateTime( TQDate( year, month, day ), - TQTime( hour, minute, second, msec ) ); - else - return TQDateTime(); -} -TQString dateTimeToString( const TQDateTime& dt ) // ISODate is returned -{ - TQString date; - TQString month( - TQString::number( dt.date().month() ).rightJustify( 2, '0' ) ); - TQString day( - TQString::number( dt.date().day() ).rightJustify( 2, '0' ) ); - date = TQString::number( dt.date().year() ) + "-" + month + "-" + day; - TQString time; - time.sprintf( "%.2d:%.2d:%.2d", - dt.time().hour(), dt.time().minute(), dt.time().second() ); - return date + "T" + time; -} -#endif - - /** ReCalculate the labels based upon given nDelta and nDeltaPix. @@ -577,11 +544,7 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter, if( sameDay ){ commonDtHeader = TQString::number( dLow.day() ) + ". " -#if COMPAT_TQT_VERSION >= 0x030000 + TQDate::longMonthName( dLow.month() ) -#else - + dLow.monthName( dLow.month() ) -#endif + ' ' + TQString::number( dLow.year() ); if( sameHour ){ @@ -614,11 +577,7 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter, commonDtHeader += "00"; } }else if( sameMonth ) -#if COMPAT_TQT_VERSION >= 0x030000 commonDtHeader = TQDate::longMonthName( dLow.month() ) -#else - commonDtHeader = dLow.monthName( dLow.month() ) -#endif + ' ' + TQString::number( dLow.year() ); else if( sameYear ) @@ -689,14 +648,9 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter, TQString text; if( cv.isDateTime ){ -#if COMPAT_TQT_VERSION >= 0x030000 TQDateTime dt( TQDateTime::fromString( *it, Qt::ISODate ) ); text = dt.toString( formatDT ); -#else - TQDateTime dt( dateTimeFromString( *it ) ); - text = dt.toString(); -#endif }else{ text = *it; } @@ -1690,14 +1644,9 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter, ++labelIter ) { TQDateTime dt; if( cv.isDateTime ){ -#if COMPAT_TQT_VERSION >= 0x030000 dt = TQDateTime::fromString( *labelIter, Qt::ISODate ); label = dt.toString( formatDT ); -#else - dt = dateTimeFromString( *labelIter ); - label = dt.toString(); -#endif }else{ label = *labelIter; } @@ -3282,11 +3231,7 @@ void KDChartAxesPainter::calculateLabelTexts( if( autoDtLabels ) labelTexts.append( "x" ); else -#if COMPAT_TQT_VERSION >= 0x030000 labelTexts.append( dt.toString( Qt::ISODate ) ); -#else - labelTexts.append( dateTimeToString( dt ) ); -#endif bDone = (goDown ? (dt < dtLow ) : (dt > dtHigh)); /*if( bDone ){ dtHigh = dt; @@ -4430,12 +4375,7 @@ void KDChartAxesPainter::paintData( TQPainter* painter, //ourClipRect.setRight( ourClipRect.right() - 1 ); const TQWMatrix & world = painter->worldMatrix(); - ourClipRect = -#if COMPAT_TQT_VERSION >= 0x030000 - world.mapRect( ourClipRect ); -#else - world.map( ourClipRect ); -#endif + ourClipRect = world.mapRect( ourClipRect ); painter->setClipRect( ourClipRect ); painter->translate( _dataRect.x(), _dataRect.y() ); diff --git a/libkdchart/KDChartGlobal.h b/libkdchart/KDChartGlobal.h index fc96072..9470a4c 100644 --- a/libkdchart/KDChartGlobal.h +++ b/libkdchart/KDChartGlobal.h @@ -50,32 +50,15 @@ \brief Definition of global macros. */ - - #if defined(_MSC_VER) #ifndef TQT_NO_STL #define TQT_NO_STL // Avoid a name clash #endif #endif - - -// --- new format since TQt 3.0.0 or since 3.0.4 ??? -#ifndef COMPAT_TQT_VERSION -#if defined(_MSC_VER) -#pragma message( "using TQt > 2.3.2" ) -#endif -//#define COMPAT_TQT_VERSION [[[TQT_VERSION IS DEPRECATED]]] -#define COMPAT_TQT_VERSION 0x039999 -#endif - -// since TQt 3.1 they do /not/ include limits.h or climits on windows anymore -// so we must include that manually -#if COMPAT_TQT_VERSION > 0x030099 #if defined(_MSC_VER) #include #endif -#endif #include #include diff --git a/libkdchart/KDChartParams.cpp b/libkdchart/KDChartParams.cpp index 97ab1f4..2d0851f 100644 --- a/libkdchart/KDChartParams.cpp +++ b/libkdchart/KDChartParams.cpp @@ -119,15 +119,9 @@ KDChartParams::KDChartParams() setAllowOverlappingDataValueTexts( false ); -#if COMPAT_TQT_VERSION >= 0x030100 setOptimizeOutputForScreen( false ); -#else - setOptimizeOutputForScreen( true ); -#endif - setGlobalLeading( 0,0,0,0 ); - // Default type is bar charts setChartType( Bar ); diff --git a/libkdchart/KDChartPiePainter.cpp b/libkdchart/KDChartPiePainter.cpp index 6739872..55ae2eb 100644 --- a/libkdchart/KDChartPiePainter.cpp +++ b/libkdchart/KDChartPiePainter.cpp @@ -95,13 +95,7 @@ void KDChartPiePainter::paintData( TQPainter* painter, ourClipRect.addCoords( -1,-1,1,1 ); const TQWMatrix & world = painter->worldMatrix(); - ourClipRect = -#if COMPAT_TQT_VERSION >= 0x030000 - world.mapRect( ourClipRect ); -#else - world.map( ourClipRect ); -#endif - + ourClipRect = world.mapRect( ourClipRect ); painter->setClipRect( ourClipRect ); // find which dataset to paint diff --git a/libkdchart/KDChartPolarPainter.cpp b/libkdchart/KDChartPolarPainter.cpp index 15ff5f0..58ea9b6 100644 --- a/libkdchart/KDChartPolarPainter.cpp +++ b/libkdchart/KDChartPolarPainter.cpp @@ -95,13 +95,7 @@ void KDChartPolarPainter::paintData( TQPainter* painter, // const TQWMatrix & world = painter->worldMatrix(); - ourClipRect = -#if COMPAT_TQT_VERSION >= 0x030000 - world.mapRect( ourClipRect ); -#else - world.map( ourClipRect ); -#endif - + ourClipRect = world.mapRect( ourClipRect ); painter->setClipRect( ourClipRect ); diff --git a/libkdchart/KDChartRingPainter.cpp b/libkdchart/KDChartRingPainter.cpp index ec58881..79ac95f 100644 --- a/libkdchart/KDChartRingPainter.cpp +++ b/libkdchart/KDChartRingPainter.cpp @@ -90,13 +90,7 @@ void KDChartRingPainter::paintData( TQPainter* painter, TQRect ourClipRect( _dataRect ); const TQWMatrix & world = painter->worldMatrix(); - ourClipRect = -#if COMPAT_TQT_VERSION >= 0x030000 - world.mapRect( ourClipRect ); -#else - world.map( ourClipRect ); -#endif - + ourClipRect = world.mapRect( ourClipRect ); ourClipRect.setTop(ourClipRect.top()-1); ourClipRect.setLeft(ourClipRect.left()-1); ourClipRect.setBottom(ourClipRect.bottom()+1); diff --git a/libkdchart/KDChartTable.h b/libkdchart/KDChartTable.h index d915db9..259ee46 100644 --- a/libkdchart/KDChartTable.h +++ b/libkdchart/KDChartTable.h @@ -33,15 +33,8 @@ #include #include -#if COMPAT_TQT_VERSION >= 0x030000 #include -#endif -#if COMPAT_TQT_VERSION >= 0x030000 typedef KDChartVectorTableData KDChartTableData; -#else -typedef KDChartListTableData KDChartTableData; -#endif - #endif diff --git a/libkdchart/KDChartVectorSeries.cpp b/libkdchart/KDChartVectorSeries.cpp index 81c6352..4ef505f 100644 --- a/libkdchart/KDChartVectorSeries.cpp +++ b/libkdchart/KDChartVectorSeries.cpp @@ -72,12 +72,7 @@ double KDChartVectorSeries::maxValue( int coordinate, bool &ok ) const double maxValue = 0.0; bool bStart = true; -#if COMPAT_TQT_VERSION >= 0x030000 KDChartVectorSeries::const_iterator i; -#else - KDChartVectorSeries::ConstIterator i; -#endif - for ( i = begin(); i != end(); i ++ ) { const KDChartData& d = *i; @@ -104,12 +99,7 @@ double KDChartVectorSeries::minValue( int coordinate, bool &ok ) const double minValue = 0.0; bool bStart = true; -#if COMPAT_TQT_VERSION >= 0x030000 KDChartVectorSeries::const_iterator i; -#else - KDChartVectorSeries::ConstIterator i; -#endif - for ( i = begin(); i != end(); i ++ ) { const KDChartData& d = *i; diff --git a/libkdchart/KDXMLTools.cpp b/libkdchart/KDXMLTools.cpp index 4450fd3..7ccecb2 100644 --- a/libkdchart/KDXMLTools.cpp +++ b/libkdchart/KDXMLTools.cpp @@ -227,10 +227,6 @@ namespace KDXML { createIntNode( doc, fontElement, "PointSize", font.pointSize() ); createIntNode( doc, fontElement, "Weight", font.weight() ); createBoolNode( doc, fontElement, "Italic", font.italic() ); -#if COMPAT_TQT_VERSION < 0x030000 - // TQt 3 handles the charset internally. - createIntNode( doc, fontElement, "CharSet", font.charSet() ); -#endif } @@ -619,10 +615,6 @@ namespace KDXML { font.setPointSize( pointSize ); font.setWeight( weight ); font.setItalic( italic ); -#if COMPAT_TQT_VERSION < 0x030000 - // TQt 3 handles charsets internally. - font.setCharSet( (TQFont::CharSet)charSet ); -#endif } return ok;