From 87a016680e3677da3993f333561e79eb0cead7d5 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 29 Jun 2011 16:05:55 +0000 Subject: TQt4 port ktechlab This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/mechanics/mechanicsitem.cpp | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/mechanics/mechanicsitem.cpp') diff --git a/src/mechanics/mechanicsitem.cpp b/src/mechanics/mechanicsitem.cpp index acf2239..379face 100644 --- a/src/mechanics/mechanicsitem.cpp +++ b/src/mechanics/mechanicsitem.cpp @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include /** @@ -30,7 +30,7 @@ double normalizeAngle( double angle ) return angle - 6.2832*std::floor(angle/6.2832); } -MechanicsItem::MechanicsItem( MechanicsDocument *mechanicsDocument, bool newItem, const QString &id ) +MechanicsItem::MechanicsItem( MechanicsDocument *mechanicsDocument, bool newItem, const TQString &id ) : Item( mechanicsDocument, newItem, id ) { p_mechanicsDocument = mechanicsDocument; @@ -102,9 +102,9 @@ void MechanicsItem::dataChanged() PositionInfo MechanicsItem::absolutePosition() const { - MechanicsItem *parentMechItem = dynamic_cast((Item*)(p_parentItem)); - if (parentMechItem) - return parentMechItem->absolutePosition() + m_relativePosition; + MechanicsItem *tqparentMechItem = dynamic_cast((Item*)(p_parentItem)); + if (tqparentMechItem) + return tqparentMechItem->absolutePosition() + m_relativePosition; return m_relativePosition; } @@ -118,13 +118,13 @@ void MechanicsItem::reparented( Item *oldItem, Item *newItem ) if (oldMechItem) { m_relativePosition = oldMechItem->absolutePosition() + m_relativePosition; - disconnect( oldMechItem, SIGNAL(moved()), this, SLOT(parentMoved()) ); + disconnect( oldMechItem, TQT_SIGNAL(moved()), this, TQT_SLOT(tqparentMoved()) ); } if (newMechItem) { m_relativePosition = m_relativePosition - newMechItem->absolutePosition(); - connect( newMechItem, SIGNAL(moved()), this, SLOT(parentMoved()) ); + connect( newMechItem, TQT_SIGNAL(moved()), this, TQT_SLOT(tqparentMoved()) ); } updateCanvasPoints(); @@ -137,7 +137,7 @@ void MechanicsItem::childAdded( Item *child ) if (!mechItem) return; - connect( mechItem, SIGNAL(updateMechanicsInfoCombined()), this, SLOT(childMoved()) ); + connect( mechItem, TQT_SIGNAL(updateMechanicsInfoCombined()), this, TQT_SLOT(childMoved()) ); updateMechanicsInfoCombined(); } @@ -148,12 +148,12 @@ void MechanicsItem::childRemoved( Item *child ) if (!mechItem) return; - disconnect( mechItem, SIGNAL(updateMechanicsInfoCombined()), this, SLOT(childMoved()) ); + disconnect( mechItem, TQT_SIGNAL(updateMechanicsInfoCombined()), this, TQT_SLOT(childMoved()) ); updateMechanicsInfoCombined(); } -void MechanicsItem::parentMoved() +void MechanicsItem::tqparentMoved() { PositionInfo absPos = absolutePosition(); Item::moveBy( absPos.x() - x(), absPos.y() - y() ); @@ -164,21 +164,21 @@ void MechanicsItem::parentMoved() void MechanicsItem::updateCanvasPoints() { - const QRect ipbr = m_itemPoints.boundingRect(); + const TQRect ipbr = m_itemPoints.boundingRect(); double scalex = double(m_sizeRect.width()) / double(ipbr.width()); double scaley = double(m_sizeRect.height()) / double(ipbr.height()); PositionInfo abs = absolutePosition(); - QWMatrix m; + TQWMatrix m; m.rotate(abs.angle()*57.29577951308232); m.translate( m_sizeRect.left(), m_sizeRect.top() ); m.scale( scalex, scaley ); m.translate( -int(ipbr.left()), -int(ipbr.top()) ); setPoints( m.map(m_itemPoints) ); - QRect tempt = m.mapRect(ipbr); + TQRect tempt = m.mapRect(ipbr); } @@ -206,8 +206,8 @@ void MechanicsItem::updateMechanicsInfoCombined() double mass_x = 0.; double mass_y = 0.; - const ItemList::const_iterator end = m_children.end(); - for ( ItemList::const_iterator it = m_children.begin(); it != end; ++it ) + const ItemList::const_iterator end = m_tqchildren.end(); + for ( ItemList::const_iterator it = m_tqchildren.begin(); it != end; ++it ) { MechanicsItem *child = dynamic_cast((Item*)*it); if (child) @@ -287,9 +287,9 @@ void MechanicsItem::leaveEvent() } -QRect MechanicsItem::maxInnerRectangle( const QRect &outerRect ) const +TQRect MechanicsItem::maxInnerRectangle( const TQRect &outerRect ) const { - QRect normalizedOuterRect = outerRect.normalize(); + TQRect normalizedOuterRect = outerRect.normalize(); const double LEFT = normalizedOuterRect.left(); const double TOP = normalizedOuterRect.top(); const double X = normalizedOuterRect.width(); @@ -330,11 +330,11 @@ QRect MechanicsItem::maxInnerRectangle( const QRect &outerRect ) const left = std::cos(a) * (LEFT + width*std::sin(a)) + std::sin(a)*TOP; } - return QRect( int(left), int(top), int(width), int(height) ); + return TQRect( int(left), int(top), int(width), int(height) ); } -void MechanicsItem::initPainter( QPainter &p ) +void MechanicsItem::initPainter( TQPainter &p ) { PositionInfo absPos = absolutePosition(); p.translate( absPos.x(), absPos.y() ); @@ -344,7 +344,7 @@ void MechanicsItem::initPainter( QPainter &p ) } -void MechanicsItem::deinitPainter( QPainter &p ) +void MechanicsItem::deinitPainter( TQPainter &p ) { PositionInfo absPos = absolutePosition(); p.translate( absPos.x(), absPos.y() ); -- cgit v1.2.1