From fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 5 Jul 2011 06:00:29 +0000 Subject: 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 --- libkdchart/KDFrame.cpp | 124 ++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'libkdchart/KDFrame.cpp') diff --git a/libkdchart/KDFrame.cpp b/libkdchart/KDFrame.cpp index a8a1833..23bdcc3 100644 --- a/libkdchart/KDFrame.cpp +++ b/libkdchart/KDFrame.cpp @@ -1,5 +1,5 @@ /* -*- Mode: C++ -*- - KD Tools - a set of useful widgets for Qt + KD Tools - a set of useful widgets for TQt */ /**************************************************************************** @@ -27,8 +27,8 @@ ** **********************************************************************/ -#include -#include +#include +#include #include #include @@ -39,7 +39,7 @@ #else #include #endif -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN #define M_PI 3.14159265358979323846 #endif @@ -58,15 +58,15 @@ KDFrame::KDFrameCorner::~KDFrameCorner() -void KDFrame::paintBackground( QPainter& painter, const QRect& innerRect ) const +void KDFrame::paintBackground( TQPainter& painter, const TQRect& innerRect ) const { /* first draw the brush (may contain a pixmap)*/ - if( Qt::NoBrush != _background.style() ) { - QPen oldPen( painter.pen() ); - QPoint oldOrig( painter.brushOrigin() ); - QBrush oldBrush( painter.brush() ); - painter.setPen( Qt::NoPen ); - const QPoint newTopLeft( painter.xForm( innerRect.topLeft() ) ); + if( TQt::NoBrush != _background.style() ) { + TQPen oldPen( painter.pen() ); + TQPoint oldOrig( painter.brushOrigin() ); + TQBrush oldBrush( painter.brush() ); + painter.setPen( TQt::NoPen ); + const TQPoint newTopLeft( painter.xForm( innerRect.topLeft() ) ); painter.setBrushOrigin( newTopLeft.x(), newTopLeft.y() ); painter.setBrush( _background ); painter.drawRect( innerRect.x(), innerRect.y(), @@ -77,14 +77,14 @@ void KDFrame::paintBackground( QPainter& painter, const QRect& innerRect ) const } /* next draw the backPixmap over the brush */ if( ! _backPixmap.isNull() ) { - QPoint ol = innerRect.topLeft(); + TQPoint ol = innerRect.topLeft(); if( PixCentered == _backPixmapMode ) { ol.setX( innerRect.center().x() - _backPixmap.width() / 2 ); ol.setY( innerRect.center().y() - _backPixmap.height()/ 2 ); bitBlt( painter.device(), ol, &_backPixmap ); } else { - QWMatrix m; + TQWMatrix m; double zW = (double)innerRect.width() / (double)_backPixmap.width(); double zH = (double)innerRect.height() / (double)_backPixmap.height(); switch ( _backPixmapMode ) { @@ -92,7 +92,7 @@ void KDFrame::paintBackground( QPainter& painter, const QRect& innerRect ) const break; case PixScaled: { double z; - z = QMIN( zW, zH ); + z = TQMIN( zW, zH ); m.scale( z, z ); } break; @@ -100,7 +100,7 @@ void KDFrame::paintBackground( QPainter& painter, const QRect& innerRect ) const m.scale( zW, zH ); break; } - QPixmap pm = _backPixmap.xForm( m ); + TQPixmap pm = _backPixmap.xForm( m ); ol.setX( innerRect.center().x() - pm.width() / 2 ); ol.setY( innerRect.center().y() - pm.height()/ 2 ); bitBlt( painter.device(), ol, &pm ); @@ -109,7 +109,7 @@ void KDFrame::paintBackground( QPainter& painter, const QRect& innerRect ) const } -void KDFrame::paintEdges( QPainter& painter, const QRect& innerRect ) const +void KDFrame::paintEdges( TQPainter& painter, const TQRect& innerRect ) const { /* @@ -122,17 +122,17 @@ void KDFrame::paintEdges( QPainter& painter, const QRect& innerRect ) const KDFrameProfileSection* section; for ( section = ((KDFrameProfile)_topProfile).last(); section; section = ((KDFrameProfile)_topProfile).prev() ){ - const QPen oldPen = painter.pen(); - const QBrush oldBrush = painter.brush(); - QPen thePen; + const TQPen oldPen = painter.pen(); + const TQBrush oldBrush = painter.brush(); + TQPen thePen; thePen = section->pen(); - int penWidth = QMAX(thePen.width(), 1) * QMAX(section->width(), 1); + int penWidth = TQMAX(thePen.width(), 1) * TQMAX(section->width(), 1); //qDebug("paintEdges: thePen.width() = %i", thePen.width()); //qDebug("paintEdges: section->width() = %i", section->width()); //qDebug("paintEdges: penWidth = %i", penWidth); thePen.setWidth( penWidth ); painter.setPen( thePen ); - painter.setBrush( Qt::NoBrush ); + painter.setBrush( TQt::NoBrush ); painter.drawRect( innerRect.x()-penWidth, innerRect.y()-penWidth, innerRect.width() +2*penWidth, @@ -144,7 +144,7 @@ void KDFrame::paintEdges( QPainter& painter, const QRect& innerRect ) const } -void KDFrame::paintCorners( QPainter& /*painter*/, const QRect& /*innerRect*/ ) const +void KDFrame::paintCorners( TQPainter& /*painter*/, const TQRect& /*innerRect*/ ) const { // At the moment nothing is done here since the setSimpleFrame() function // does not allow specifying corners: all predefined frames have normal @@ -153,12 +153,12 @@ void KDFrame::paintCorners( QPainter& /*painter*/, const QRect& /*innerRect*/ ) } -void KDFrame::paint( QPainter* painter, +void KDFrame::paint( TQPainter* painter, KDFramePaintSteps steps, - QRect innerRect ) const + TQRect innerRect ) const { if( painter ) { - const QRect& rect = innerRect.isValid() ? innerRect : _innerRect; + const TQRect& rect = innerRect.isValid() ? innerRect : _innerRect; switch( steps ) { case PaintBackground: paintBackground( *painter, rect ); @@ -199,7 +199,7 @@ void KDFrame::clearProfile( ProfileName name ) void KDFrame::addProfileSection( ProfileName name, int wid, - QPen pen, + TQPen pen, KDFrameProfileSection::Direction dir, KDFrameProfileSection::Curvature curv ) { @@ -248,9 +248,9 @@ const KDFrameProfile& KDFrame::profile( ProfileName name ) const void KDFrame::setSimpleFrame( SimpleFrame frame, int lineWidth, int midLineWidth, - QPen pen, - QBrush background, - const QPixmap* backPixmap, + TQPen pen, + TQBrush background, + const TQPixmap* backPixmap, BackPixmapMode backPixmapMode ) { _profileSections.clear(); @@ -259,7 +259,7 @@ void KDFrame::setSimpleFrame( SimpleFrame frame, _bottomProfile.clear(); _leftProfile.clear(); _background = background; - _backPixmap = backPixmap ? *backPixmap : QPixmap(); + _backPixmap = backPixmap ? *backPixmap : TQPixmap(); _backPixmapMode = backPixmapMode; if( FrameFlat == frame ) { //qDebug("_profileSections.count() before = %i", _profileSections.count()); @@ -284,7 +284,7 @@ void KDFrame::setSimpleFrame( SimpleFrame frame, int line3 = line2; int gap2 = line2 * 4; int gap1 = lineWidth - line1 - line2 - line3 - gap2; - QPen noP( Qt::NoPen ); + TQPen noP( TQt::NoPen ); KDFrameProfileSection* newsection; newsection = new KDFrameProfileSection( KDFrameProfileSection::DirPlain, KDFrameProfileSection::CvtPlain, @@ -404,12 +404,12 @@ void KDFrame::setSimpleFrame( SimpleFrame frame, } -void KDFrame::createFrameNode( QDomDocument& document, QDomNode& parent, - const QString& elementName, +void KDFrame::createFrameNode( TQDomDocument& document, TQDomNode& tqparent, + const TQString& elementName, const KDFrame& frame ) { - QDomElement frameElement = document.createElement( elementName ); - parent.appendChild( frameElement ); + TQDomElement frameElement = document.createElement( elementName ); + tqparent.appendChild( frameElement ); KDXML::createIntNode( document, frameElement, "ShadowWidth", frame._shadowWidth ); KDXML::createStringNode( document, frameElement, "CornerName", @@ -442,12 +442,12 @@ void KDFrame::createFrameNode( QDomDocument& document, QDomNode& parent, frame._cornerBR ); } -void KDFrame::createFrameProfileNode( QDomDocument& document, QDomNode& parent, - const QString& elementName, +void KDFrame::createFrameProfileNode( TQDomDocument& document, TQDomNode& tqparent, + const TQString& elementName, KDFrameProfile profile ) { - QDomElement profileElement = document.createElement( elementName ); - parent.appendChild( profileElement ); + TQDomElement profileElement = document.createElement( elementName ); + tqparent.appendChild( profileElement ); for( const KDFrameProfileSection* section = profile.first(); section != 0; section = profile.next() ) KDFrameProfileSection::createFrameProfileSectionNode( document, @@ -457,13 +457,13 @@ void KDFrame::createFrameProfileNode( QDomDocument& document, QDomNode& parent, } -void KDFrame::KDFrameCorner::createFrameCornerNode( QDomDocument& document, - QDomNode& parent, - const QString& elementName, +void KDFrame::KDFrameCorner::createFrameCornerNode( TQDomDocument& document, + TQDomNode& tqparent, + const TQString& elementName, const KDFrameCorner& corner ) { - QDomElement cornerElement = document.createElement( elementName ); - parent.appendChild( cornerElement ); + TQDomElement cornerElement = document.createElement( elementName ); + tqparent.appendChild( cornerElement ); KDXML::createStringNode( document, cornerElement, "Style", KDFrame::cornerStyleToString( corner._style ) ); KDXML::createIntNode( document, cornerElement, "Width", @@ -472,27 +472,27 @@ void KDFrame::KDFrameCorner::createFrameCornerNode( QDomDocument& document, corner._profile ); } -bool KDFrame::readFrameNode( const QDomElement& element, KDFrame& frame ) +bool KDFrame::readFrameNode( const TQDomElement& element, KDFrame& frame ) { bool ok = true; int tempShadowWidth; CornerName tempCornerName=CornerTopLeft; - QBrush tempBackground; - QPixmap tempBackPixmap; + TQBrush tempBackground; + TQPixmap tempBackPixmap; BackPixmapMode tempBackPixmapMode=PixStretched; - QRect tempInnerRect; + TQRect tempInnerRect; KDFrameProfile tempTopProfile, tempRightProfile, tempBottomProfile, tempLeftProfile; KDFrameCorner tempCornerTL, tempCornerTR, tempCornerBL, tempCornerBR; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "ShadowWidth" ) { ok = ok & KDXML::readIntNode( element, tempShadowWidth ); } else if( tagName == "CornerName" ) { - QString value; + TQString value; ok = ok & KDXML::readStringNode( element, value ); tempCornerName = stringToCornerName( value ); } else if( tagName == "Background" ) { @@ -500,7 +500,7 @@ bool KDFrame::readFrameNode( const QDomElement& element, KDFrame& frame ) } else if( tagName == "BackPixmap" ) { ok = ok & KDXML::readPixmapNode( element, tempBackPixmap ); } else if( tagName == "BackPixmapMode" ) { - QString value; + TQString value; ok = ok & KDXML::readStringNode( element, value ); tempBackPixmapMode = stringToBackPixmapMode( value ); } else if( tagName == "InnerRect" ) { @@ -553,14 +553,14 @@ bool KDFrame::readFrameNode( const QDomElement& element, KDFrame& frame ) } -bool KDFrame::readFrameProfileNode( const QDomElement& element, +bool KDFrame::readFrameProfileNode( const TQDomElement& element, KDFrameProfile& profile ) { - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "ProfileSection" ) { KDFrameProfileSection* section = new KDFrameProfileSection(); KDFrameProfileSection::readFrameProfileSectionNode( element, @@ -578,20 +578,20 @@ bool KDFrame::readFrameProfileNode( const QDomElement& element, } -bool KDFrame::KDFrameCorner::readFrameCornerNode( const QDomElement& element, +bool KDFrame::KDFrameCorner::readFrameCornerNode( const TQDomElement& element, KDFrameCorner& corner ) { bool ok = true; CornerStyle tempStyle=CornerNormal; int tempWidth; KDFrameProfile tempProfile; - QDomNode node = element.firstChild(); + TQDomNode node = element.firstChild(); while( !node.isNull() ) { - QDomElement element = node.toElement(); + TQDomElement element = node.toElement(); if( !element.isNull() ) { // was really an element - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if( tagName == "Style" ) { - QString value; + TQString value; ok = ok & KDXML::readStringNode( element, value ); tempStyle = stringToCornerStyle( value ); } else if( tagName == "Width" ) { -- cgit v1.2.1