summaryrefslogtreecommitdiffstats
path: root/src/mechanics
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
commit87a016680e3677da3993f333561e79eb0cead7d5 (patch)
treecbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/mechanics
parent6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff)
downloadktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz
ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip
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
Diffstat (limited to 'src/mechanics')
-rw-r--r--src/mechanics/chassiscircular2.cpp34
-rw-r--r--src/mechanics/chassiscircular2.h6
-rw-r--r--src/mechanics/mechanicsdocument.cpp24
-rw-r--r--src/mechanics/mechanicsdocument.h21
-rw-r--r--src/mechanics/mechanicsgroup.cpp48
-rw-r--r--src/mechanics/mechanicsgroup.h13
-rw-r--r--src/mechanics/mechanicsitem.cpp44
-rw-r--r--src/mechanics/mechanicsitem.h25
-rw-r--r--src/mechanics/mechanicssimulation.cpp24
-rw-r--r--src/mechanics/mechanicssimulation.h21
-rw-r--r--src/mechanics/mechanicsview.cpp2
-rw-r--r--src/mechanics/mechanicsview.h3
12 files changed, 135 insertions, 130 deletions
diff --git a/src/mechanics/chassiscircular2.cpp b/src/mechanics/chassiscircular2.cpp
index 91b9f0a..715073f 100644
--- a/src/mechanics/chassiscircular2.cpp
+++ b/src/mechanics/chassiscircular2.cpp
@@ -13,8 +13,8 @@
#include "libraryitem.h"
#include <klocale.h>
-#include <qpainter.h>
-#include <qwmatrix.h>
+#include <tqpainter.h>
+#include <tqwmatrix.h>
#include <algorithm>
#include <cmath>
@@ -31,7 +31,7 @@ Item* ChassisCircular2::construct( ItemDocument *itemDocument, bool newItem, con
LibraryItem* ChassisCircular2::libraryItem()
{
return new LibraryItem(
- QString("mech/chassis_circular_2"),
+ TQString("mech/chassis_circular_2"),
i18n("Circular 2-Wheel Chassis"),
i18n("Chassis'"),
"chassis.png",
@@ -49,10 +49,10 @@ ChassisCircular2::ChassisCircular2( MechanicsDocument *mechanicsDocument, bool n
m_theta1 = 0.0;
m_theta2 = 0.0;
- QPointArray pa;
+ TQPointArray pa;
pa.makeEllipse( -25, -25, 50, 50 );
- QWMatrix m(4,0,0,4,0,0);
- m.setTransformationMode( QWMatrix::Areas );
+ TQWMatrix m(4,0,0,4,0,0);
+ m.setTransformationMode( TQWMatrix::Areas );
pa = m.map(pa);
setItemPoints(pa);
@@ -70,8 +70,8 @@ void ChassisCircular2::itemResized()
const double w = sizeRect().width();
const double h = sizeRect().height();
- m_wheel1Pos = QRect( int(w/5), int(h/6), int(w/4), int(h/8) );
- m_wheel2Pos = QRect( int(w/5), int(5*h/6-h/8), int(w/4), int(h/8) );
+ m_wheel1Pos = TQRect( int(w/5), int(h/6), int(w/4), int(h/8) );
+ m_wheel2Pos = TQRect( int(w/5), int(5*h/6-h/8), int(w/4), int(h/8) );
}
@@ -97,7 +97,7 @@ void ChassisCircular2::advance( int phase )
}
-void ChassisCircular2::drawShape( QPainter &p )
+void ChassisCircular2::drawShape( TQPainter &p )
{
const double _x = int(sizeRect().x() + x());
const double _y = int(sizeRect().y() + y());
@@ -105,8 +105,8 @@ void ChassisCircular2::drawShape( QPainter &p )
const double h = sizeRect().height();
initPainter(p);
- p.setBrush( QColor( 255, 246, 210 ) );
- QRect circleRect = sizeRect();
+ p.setBrush( TQColor( 255, 246, 210 ) );
+ TQRect circleRect = sizeRect();
circleRect.moveLeft( int(circleRect.left() + x()) );
circleRect.moveTop( int(circleRect.top() + y()) );
p.drawEllipse(circleRect);
@@ -118,24 +118,24 @@ void ChassisCircular2::drawShape( QPainter &p )
const double y1 = _y+(h/6); // Wheel 1 y-pos
const double y2 = _y+(5*h/6)-H; // Wheel 2 y-pos
- p.setPen( Qt::NoPen );
+ p.setPen( TQt::NoPen );
const double stripeWidth = 5;
const double offset2 = 1 + int(m_theta1*m_wheel1Pos.width())%int(2*stripeWidth);
const double offset1 = 1 + int(m_theta2*m_wheel2Pos.width())%int(2*stripeWidth);
- p.setBrush( QColor( 255, 232, 182 ) );
+ p.setBrush( TQColor( 255, 232, 182 ) );
for ( double i=-1; i<std::ceil(m_wheel1Pos.width()/stripeWidth); ++i )
{
- p.setClipRect( QRect( int(_x+m_wheel1Pos.x()+2), int(_y+m_wheel1Pos.y()+2), int(m_wheel1Pos.width()-4), int(m_wheel1Pos.height()-4) ), QPainter::CoordPainter );
+ p.setClipRect( TQRect( int(_x+m_wheel1Pos.x()+2), int(_y+m_wheel1Pos.y()+2), int(m_wheel1Pos.width()-4), int(m_wheel1Pos.height()-4) ), TQPainter::CoordPainter );
p.drawRect( int(offset1+X + i*stripeWidth*2), int(y1+1), int(stripeWidth), int(H-2) );
- p.setClipRect( QRect( int(_x+m_wheel2Pos.x()+2), int(_y+m_wheel2Pos.y()+2), int(m_wheel2Pos.width()-4), int(m_wheel2Pos.height()-4) ), QPainter::CoordPainter );
+ p.setClipRect( TQRect( int(_x+m_wheel2Pos.x()+2), int(_y+m_wheel2Pos.y()+2), int(m_wheel2Pos.width()-4), int(m_wheel2Pos.height()-4) ), TQPainter::CoordPainter );
p.drawRect( int(offset2+X + i*stripeWidth*2), int(y2+1), int(stripeWidth), int(H-2) );
}
p.setClipping(false);
- p.setPen( Qt::black );
- p.setBrush( Qt::NoBrush );
+ p.setPen( TQt::black );
+ p.setBrush( TQt::NoBrush );
p.drawRoundRect( int(X), int(y1), int(w/4), int(H), 25, 50 );
p.drawRoundRect( int(X), int(y2), int(w/4), int(H), 25, 50 );
diff --git a/src/mechanics/chassiscircular2.h b/src/mechanics/chassiscircular2.h
index 1c8897a..d0752b7 100644
--- a/src/mechanics/chassiscircular2.h
+++ b/src/mechanics/chassiscircular2.h
@@ -30,13 +30,13 @@ public:
protected:
virtual void itemResized();
- void drawShape( QPainter &p );
+ void drawShape( TQPainter &p );
double m_theta1; // Angle of rotation of wheel 1 (used for drawing)
double m_theta2; // Angle of rotation of wheel 1 (used for drawing)
- QRect m_wheel1Pos; // Position of first wheel, with respect to top left of item
- QRect m_wheel2Pos; // Position of second wheel, with respect to top left of item
+ TQRect m_wheel1Pos; // Position of first wheel, with respect to top left of item
+ TQRect m_wheel2Pos; // Position of second wheel, with respect to top left of item
};
#endif
diff --git a/src/mechanics/mechanicsdocument.cpp b/src/mechanics/mechanicsdocument.cpp
index 0b2fa3b..f11d421 100644
--- a/src/mechanics/mechanicsdocument.cpp
+++ b/src/mechanics/mechanicsdocument.cpp
@@ -20,7 +20,7 @@
#include <klocale.h>
-MechanicsDocument::MechanicsDocument( const QString &caption, KTechlab *ktechlab, const char *name )
+MechanicsDocument::MechanicsDocument( const TQString &caption, KTechlab *ktechlab, const char *name )
: ItemDocument( caption, ktechlab, name )
{
m_type = Document::dt_mechanics;
@@ -67,7 +67,7 @@ ItemGroup *MechanicsDocument::selectList() const
-bool MechanicsDocument::isValidItem( const QString &itemId )
+bool MechanicsDocument::isValidItem( const TQString &itemId )
{
return itemId.startsWith("mech/") || itemId.startsWith("dp/");
}
@@ -79,7 +79,7 @@ bool MechanicsDocument::isValidItem( Item *item )
}
-Item* MechanicsDocument::addItem( const QString &id, const QPoint &p, bool newItem )
+Item* MechanicsDocument::addItem( const TQString &id, const TQPoint &p, bool newItem )
{
if ( !isValidItem(id) )
return 0l;
@@ -88,7 +88,7 @@ Item* MechanicsDocument::addItem( const QString &id, const QPoint &p, bool newIt
if (!item)
return 0L;
- QRect rect = item->boundingRect();
+ TQRect rect = item->boundingRect();
int dx = (int)(p.x())-rect.width()/2;
int dy = (int)(p.y())-rect.height()/2;
@@ -130,24 +130,24 @@ void MechanicsDocument::deleteSelection()
}
-bool MechanicsDocument::registerItem( QCanvasItem *qcanvasItem )
+bool MechanicsDocument::registerItem( TQCanvasItem *qcanvasItem )
{
return ItemDocument::registerItem(qcanvasItem);
}
-void MechanicsDocument::appendDeleteList( QCanvasItem *qcanvasItem )
+void MechanicsDocument::appendDeleteList( TQCanvasItem *qcanvasItem )
{
MechanicsItem *mechItem = dynamic_cast<MechanicsItem*>(qcanvasItem);
- if ( !mechItem || m_itemDeleteList.contains(mechItem) ) {
+ if ( !mechItem || m_itemDeleteList.tqcontains(mechItem) ) {
return;
}
m_itemDeleteList.append(mechItem);
m_itemList.remove(mechItem);
- disconnect( mechItem, SIGNAL(selected(Item*,bool)), this, SIGNAL(itemSelected(Item*)) );
- disconnect( mechItem, SIGNAL(unselected(Item*,bool)), this, SIGNAL(itemUnselected(Item*)) );
+ disconnect( mechItem, TQT_SIGNAL(selected(Item*,bool)), this, TQT_SIGNAL(itemSelected(Item*)) );
+ disconnect( mechItem, TQT_SIGNAL(unselected(Item*,bool)), this, TQT_SIGNAL(itemUnselected(Item*)) );
mechItem->removeItem();
}
@@ -159,10 +159,10 @@ void MechanicsDocument::flushDeleteList()
ItemList::iterator end = m_itemDeleteList.end();
for ( ItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it )
{
- if ( *it && m_itemDeleteList.contains(*it) > 1 )
+ if ( *it && m_itemDeleteList.tqcontains(*it) > 1 )
*it = 0l;
}
- m_itemDeleteList.remove(QGuardedPtr<Item>(0l));
+ m_itemDeleteList.remove(TQGuardedPtr<Item>(0l));
end = m_itemDeleteList.end();
for ( ItemList::iterator it = m_itemDeleteList.begin(); it != end; ++it )
@@ -174,7 +174,7 @@ void MechanicsDocument::flushDeleteList()
}
-MechanicsItem* MechanicsDocument::mechanicsItemWithID( const QString &id )
+MechanicsItem* MechanicsDocument::mechanicsItemWithID( const TQString &id )
{
return dynamic_cast<MechanicsItem*>(itemWithID(id));
}
diff --git a/src/mechanics/mechanicsdocument.h b/src/mechanics/mechanicsdocument.h
index dfe454f..80b1206 100644
--- a/src/mechanics/mechanicsdocument.h
+++ b/src/mechanics/mechanicsdocument.h
@@ -18,8 +18,8 @@ class MechanicsGroup;
class MechanicsItem;
class MechanicsSimulation;
-typedef QValueList<MechanicsItem*> MechItemList;
-typedef QValueList<MechanicsItem*> MechanicsItemList;
+typedef TQValueList<MechanicsItem*> MechItemList;
+typedef TQValueList<MechanicsItem*> MechanicsItemList;
/**
@author David Saxton
@@ -27,35 +27,36 @@ typedef QValueList<MechanicsItem*> MechanicsItemList;
class MechanicsDocument : public ItemDocument
{
Q_OBJECT
+ TQ_OBJECT
public:
- MechanicsDocument( const QString &caption, KTechlab *ktechlab, const char *name = 0 );
+ MechanicsDocument( const TQString &caption, KTechlab *ktechlab, const char *name = 0 );
~MechanicsDocument();
virtual View *createView( ViewContainer *viewContainer, uint viewAreaId, const char *name = 0l );
- virtual bool isValidItem( const QString &itemId );
+ virtual bool isValidItem( const TQString &itemId );
virtual bool isValidItem( Item *item );
virtual void deleteSelection();
virtual void copy();
virtual void selectAll();
virtual ItemGroup *selectList() const;
- MechanicsItem *mechanicsItemWithID( const QString &id );
- virtual Item* addItem( const QString &id, const QPoint &p, bool newItem );
+ MechanicsItem *mechanicsItemWithID( const TQString &id );
+ virtual Item* addItem( const TQString &id, const TQPoint &p, bool newItem );
/**
- * Adds a QCanvasItem to the delete list to be deleted, when
+ * Adds a TQCanvasItem to the delete list to be deleted, when
* flushDeleteList() is called
*/
- virtual void appendDeleteList( QCanvasItem *qcanvasItem );
+ virtual void appendDeleteList( TQCanvasItem *qcanvasItem );
/**
* Permantly deletes all items that have been added to the delete list with
- * the appendDeleteList( QCanvasItem *qcanvasItem ) function.
+ * the appendDeleteList( TQCanvasItem *qcanvasItem ) function.
*/
virtual void flushDeleteList();
/**
* Register an item with the ICNDocument.
*/
- virtual bool registerItem( QCanvasItem *qcanvasItem );
+ virtual bool registerItem( TQCanvasItem *qcanvasItem );
protected:
MechanicsGroup *m_selectList;
diff --git a/src/mechanics/mechanicsgroup.cpp b/src/mechanics/mechanicsgroup.cpp
index 94fe703..8d27579 100644
--- a/src/mechanics/mechanicsgroup.cpp
+++ b/src/mechanics/mechanicsgroup.cpp
@@ -26,17 +26,17 @@ MechanicsGroup::~MechanicsGroup()
bool MechanicsGroup::addItem( Item *item )
{
- if ( !item || !item->canvas() || m_itemList.contains(item) ) {
+ if ( !item || !item->canvas() || m_itemList.tqcontains(item) ) {
return false;
}
- // Check that the item's parent isn't already selected
- Item *parent = item->parentItem();
- while (parent)
+ // Check that the item's tqparent isn't already selected
+ Item *tqparent = item->tqparentItem();
+ while (tqparent)
{
- if ( m_itemList.contains(parent) )
+ if ( m_itemList.tqcontains(tqparent) )
return false;
- parent = parent->parentItem();
+ tqparent = tqparent->tqparentItem();
}
removeChildren(item);
@@ -52,7 +52,7 @@ bool MechanicsGroup::addItem( Item *item )
bool MechanicsGroup::removeItem( Item *item )
{
- if ( !item || !m_itemList.contains(item) ) {
+ if ( !item || !m_itemList.tqcontains(item) ) {
return false;
}
unregisterItem(item);
@@ -71,9 +71,9 @@ void MechanicsGroup::removeChildren( Item *item )
if (!item)
return;
- const ItemList children = item->children();
- const ItemList::const_iterator end = children.end();
- for ( ItemList::const_iterator it = children.begin(); it != end; ++it )
+ const ItemList tqchildren = item->tqchildren();
+ const ItemList::const_iterator end = tqchildren.end();
+ for ( ItemList::const_iterator it = tqchildren.begin(); it != end; ++it )
{
removeChildren(*it);
removeItem(*it);
@@ -131,13 +131,13 @@ MechanicsItemList MechanicsGroup::toplevelMechItemList() const
const MechanicsItemList::const_iterator end = mechItemList.end();
for ( MechanicsItemList::const_iterator it = mechItemList.begin(); it != end; ++it )
{
- MechanicsItem* parent = *it;
- while (parent)
+ MechanicsItem* tqparent = *it;
+ while (tqparent)
{
- if ( !parent->parentItem() && !toplevel.contains(parent) )
- toplevel.append(parent);
+ if ( !tqparent->tqparentItem() && !toplevel.tqcontains(tqparent) )
+ toplevel.append(tqparent);
- parent = dynamic_cast<MechanicsItem*>(parent->parentItem());
+ tqparent = dynamic_cast<MechanicsItem*>(tqparent->tqparentItem());
}
}
@@ -157,14 +157,14 @@ void MechanicsGroup::setSelected( bool sel )
}
-bool MechanicsGroup::addQCanvasItem( QCanvasItem* item )
+bool MechanicsGroup::addTQCanvasItem( TQCanvasItem* item )
{
return addItem( dynamic_cast<Item*>(item) );
}
-bool MechanicsGroup::contains(QCanvasItem* item) const
+bool MechanicsGroup::tqcontains(TQCanvasItem* item) const
{
- return m_itemList.contains(dynamic_cast<Item*>(item));
+ return m_itemList.tqcontains(dynamic_cast<Item*>(item));
}
@@ -201,20 +201,20 @@ void MechanicsGroup::removeAllItems()
removeItem(m_itemList.first());
}
-void MechanicsGroup::removeQCanvasItem(QCanvasItem* item)
+void MechanicsGroup::removeTQCanvasItem(TQCanvasItem* item)
{
removeItem(dynamic_cast<Item*>(item));
}
-void MechanicsGroup::setItems(QCanvasItemList list)
+void MechanicsGroup::setItems(TQCanvasItemList list)
{
{
ItemList removeList;
const ItemList::iterator end = m_itemList.end();
for ( ItemList::iterator it = m_itemList.begin(); it != end; ++it )
{
- if ( !list.contains(*it) ) {
+ if ( !list.tqcontains(*it) ) {
removeList.append(*it);
}
}
@@ -226,12 +226,12 @@ void MechanicsGroup::setItems(QCanvasItemList list)
}
}
- const QCanvasItemList::iterator end = list.end();
- for ( QCanvasItemList::iterator it = list.begin(); it != end; ++it )
+ const TQCanvasItemList::iterator end = list.end();
+ for ( TQCanvasItemList::iterator it = list.begin(); it != end; ++it )
{
// We don't need to check that we've already got the item as it will
// be checked in the function call
- addQCanvasItem(*it);
+ addTQCanvasItem(*it);
}
}
diff --git a/src/mechanics/mechanicsgroup.h b/src/mechanics/mechanicsgroup.h
index 6b49966..c3ca347 100644
--- a/src/mechanics/mechanicsgroup.h
+++ b/src/mechanics/mechanicsgroup.h
@@ -16,7 +16,7 @@
class MechanicsItem;
class MechanicsDocument;
-typedef QValueList<MechanicsItem*> MechanicsItemList;
+typedef TQValueList<MechanicsItem*> MechanicsItemList;
/**
@author David Saxton
@@ -24,6 +24,7 @@ typedef QValueList<MechanicsItem*> MechanicsItemList;
class MechanicsGroup : public ItemGroup
{
Q_OBJECT
+ TQ_OBJECT
public:
MechanicsGroup( MechanicsDocument *mechanicsDocument, const char *name = 0);
~MechanicsGroup();
@@ -41,19 +42,19 @@ public:
*/
void setRaised( bool isRaised );
/**
- * Removes all the children of the given item from the group
+ * Removes all the tqchildren of the given item from the group
*/
void removeChildren( Item *item );
bool addItem( Item *item );
bool removeItem( Item *item );
- virtual bool addQCanvasItem(QCanvasItem* item);
- virtual bool contains(QCanvasItem* item) const;
+ virtual bool addTQCanvasItem(TQCanvasItem* item);
+ virtual bool tqcontains(TQCanvasItem* item) const;
virtual uint count() const { return itemCount(); }
virtual void deleteAllItems();
virtual void mergeGroup(ItemGroup* group);
virtual void removeAllItems();
- virtual void removeQCanvasItem(QCanvasItem* item);
- virtual void setItems(QCanvasItemList list);
+ virtual void removeTQCanvasItem(TQCanvasItem* item);
+ virtual void setItems(TQCanvasItemList list);
/**
* Sets the selected state of all items in the group
*/
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 <kdebug.h>
#include <klocale.h>
-#include <qbitarray.h>
-#include <qpainter.h>
-#include <qwmatrix.h>
+#include <tqbitarray.h>
+#include <tqpainter.h>
+#include <tqwmatrix.h>
#include <cmath>
/**
@@ -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<MechanicsItem*>((Item*)(p_parentItem));
- if (parentMechItem)
- return parentMechItem->absolutePosition() + m_relativePosition;
+ MechanicsItem *tqparentMechItem = dynamic_cast<MechanicsItem*>((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<MechanicsItem*>((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() );
diff --git a/src/mechanics/mechanicsitem.h b/src/mechanics/mechanicsitem.h
index db500fc..8c73d9d 100644
--- a/src/mechanics/mechanicsitem.h
+++ b/src/mechanics/mechanicsitem.h
@@ -12,13 +12,13 @@
#define MECHANICSITEM_H
#include <item.h>
-#include <qvaluelist.h>
+#include <tqvaluelist.h>
class LibraryItem;
class MechanicsItem;
// class MechanicsItemOverlayItem;
class MechanicsDocument;
-typedef QValueList<MechanicsItem*> MechanicsItemList;
+typedef TQValueList<MechanicsItem*> MechanicsItemList;
/**
@short Stores mass, moment of inertia
@@ -118,8 +118,9 @@ protected:
class MechanicsItem : public Item
{
Q_OBJECT
+ TQ_OBJECT
public:
- MechanicsItem( MechanicsDocument *mechanicsDocument, bool newItem, const QString &id );
+ MechanicsItem( MechanicsDocument *mechanicsDocument, bool newItem, const TQString &id );
virtual ~MechanicsItem();
enum SelectionMode
@@ -151,18 +152,18 @@ public:
*/
PositionInfo absolutePosition() const;
/**
- * Returns the position relative to the parent item (or the absolute
- * position if there is no parent item)
+ * Returns the position relative to the tqparent item (or the absolute
+ * position if there is no tqparent item)
*/
PositionInfo relativePosition() const { return m_relativePosition; }
/**
* Returns the mechanics info for this item (so not taking into account that
- * of attached children)
+ * of attached tqchildren)
*/
MechanicsInfo *mechanicsInfo() { return &m_mechanicsInfo; }
/**
* Returns the combined mechanics info for this item (which takes into
- * account that of attached children).
+ * account that of attached tqchildren).
*/
CombinedMechanicsInfo *mechanicsInfoCombined() { return &m_mechanicsInfoCombined; }
/**
@@ -170,7 +171,7 @@ public:
* rectangle, given this items current rotation. Legitimately means that
* whether this item is allowed to be distorted, inverted, resized, etc.
*/
- QRect maxInnerRectangle( const QRect &outerRect ) const;
+ TQRect maxInnerRectangle( const TQRect &outerRect ) const;
virtual ItemData itemData() const;
@@ -187,7 +188,7 @@ public slots:
* Rotate the item by the given amount (in radians)
*/
void rotateBy( double dtheta );
- void parentMoved();
+ void tqparentMoved();
signals:
/**
@@ -212,11 +213,11 @@ protected:
/**
* Sets the correct orientation on the painter
*/
- void initPainter( QPainter &p );
+ void initPainter( TQPainter &p );
/**
* *Must* be called after calling initPainter, if initPainter was called
*/
- void deinitPainter( QPainter &p );
+ void deinitPainter( TQPainter &p );
virtual void dataChanged();
virtual void itemPointsChanged() { updateCanvasPoints(); }
/**
@@ -226,7 +227,7 @@ protected:
void updateCanvasPoints();
MechanicsDocument *p_mechanicsDocument;
- PositionInfo m_relativePosition; // Absolution position if not attached to a parent item, or otherwise relative to parent item
+ PositionInfo m_relativePosition; // Absolution position if not attached to a tqparent item, or otherwise relative to tqparent item
MechanicsInfo m_mechanicsInfo;
CombinedMechanicsInfo m_mechanicsInfoCombined;
diff --git a/src/mechanics/mechanicssimulation.cpp b/src/mechanics/mechanicssimulation.cpp
index d5ec98d..c641074 100644
--- a/src/mechanics/mechanicssimulation.cpp
+++ b/src/mechanics/mechanicssimulation.cpp
@@ -13,14 +13,14 @@
#include "mechanicssimulation.h"
#include <cmath>
-#include <qtimer.h>
+#include <tqtimer.h>
MechanicsSimulation::MechanicsSimulation( MechanicsDocument *mechanicsDocument )
- : QObject(mechanicsDocument)
+ : TQObject(mechanicsDocument)
{
p_mechanicsDocument = mechanicsDocument;
- m_advanceTmr = new QTimer(this);
- connect( m_advanceTmr, SIGNAL(timeout()), this, SLOT(slotAdvance()) );
+ m_advanceTmr = new TQTimer(this);
+ connect( m_advanceTmr, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAdvance()) );
m_advanceTmr->start(1);
}
@@ -51,7 +51,7 @@ RigidBody::~RigidBody()
bool RigidBody::addMechanicsItem( MechanicsItem *item )
{
- if ( !item || m_mechanicsItemList.contains(item) )
+ if ( !item || m_mechanicsItemList.tqcontains(item) )
return false;
m_mechanicsItemList.append(item);
@@ -85,20 +85,20 @@ bool RigidBody::findOverallParent()
const MechanicsItemList::iterator end = m_mechanicsItemList.end();
for ( MechanicsItemList::iterator it = m_mechanicsItemList.begin(); it != end; ++it )
{
- MechanicsItem *parentItem = *it;
- MechanicsItem *parentCandidate = dynamic_cast<MechanicsItem*>((*it)->parentItem());
+ MechanicsItem *tqparentItem = *it;
+ MechanicsItem *tqparentCandidate = dynamic_cast<MechanicsItem*>((*it)->tqparentItem());
- while (parentCandidate)
+ while (tqparentCandidate)
{
- parentItem = parentCandidate;
- parentCandidate = dynamic_cast<MechanicsItem*>(parentItem->parentItem());
+ tqparentItem = tqparentCandidate;
+ tqparentCandidate = dynamic_cast<MechanicsItem*>(tqparentItem->tqparentItem());
}
if ( !p_overallParent )
// Must be the first item to test
- p_overallParent = parentItem;
+ p_overallParent = tqparentItem;
- if ( p_overallParent != parentItem )
+ if ( p_overallParent != tqparentItem )
{
p_overallParent = 0l;
return false;
diff --git a/src/mechanics/mechanicssimulation.h b/src/mechanics/mechanicssimulation.h
index 19b474b..9a82d91 100644
--- a/src/mechanics/mechanicssimulation.h
+++ b/src/mechanics/mechanicssimulation.h
@@ -11,13 +11,13 @@
#ifndef MECHANICSSIMULATION_H
#define MECHANICSSIMULATION_H
-#include <qguardedptr.h>
-#include <qobject.h>
-#include <qvaluelist.h>
+#include <tqguardedptr.h>
+#include <tqobject.h>
+#include <tqvaluelist.h>
class MechanicsItem;
class MechanicsDocument;
-typedef QValueList<MechanicsItem*> MechanicsItemList;
+typedef TQValueList<MechanicsItem*> MechanicsItemList;
/**
@@ -55,9 +55,10 @@ public:
/**
@author David Saxton
*/
-class MechanicsSimulation : public QObject
+class MechanicsSimulation : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
MechanicsSimulation( MechanicsDocument *mechanicsDocument );
~MechanicsSimulation();
@@ -68,15 +69,15 @@ protected slots:
void slotAdvance();
protected:
- QGuardedPtr<MechanicsDocument> p_mechanicsDocument;
- QTimer *m_advanceTmr;
+ TQGuardedPtr<MechanicsDocument> p_mechanicsDocument;
+ TQTimer *m_advanceTmr;
};
/**
Rigid body with mass, inertia, etc. Collection of mechanics items with
-functionality for moving them about, rotating, etc. Only one mother-parent
-(has no parent itself, all other items are descendents) allowed.
+functionality for moving them about, rotating, etc. Only one mother-tqparent
+(has no tqparent itself, all other items are descendents) allowed.
@short Rigid body, handles MechanicsItems
@author David Saxton
*/
@@ -106,7 +107,7 @@ public:
protected:
/**
- * Attempt to find the overall parent.
+ * Attempt to find the overall tqparent.
* @returns false iff unsucessful (including if there are no MechanicsItems present)
*/
bool findOverallParent();
diff --git a/src/mechanics/mechanicsview.cpp b/src/mechanics/mechanicsview.cpp
index d49c66a..2694b17 100644
--- a/src/mechanics/mechanicsview.cpp
+++ b/src/mechanics/mechanicsview.cpp
@@ -30,7 +30,7 @@ MechanicsView::~MechanicsView()
-void MechanicsView::dragEnterEvent( QDragEnterEvent * e )
+void MechanicsView::dragEnterEvent( TQDragEnterEvent * e )
{
ItemView::dragEnterEvent(e);
if ( e->isAccepted() )
diff --git a/src/mechanics/mechanicsview.h b/src/mechanics/mechanicsview.h
index f787b1c..cba03f6 100644
--- a/src/mechanics/mechanicsview.h
+++ b/src/mechanics/mechanicsview.h
@@ -21,12 +21,13 @@ class MechanicsDocument;
class MechanicsView : public ItemView
{
Q_OBJECT
+ TQ_OBJECT
public:
MechanicsView( MechanicsDocument *mechanicsDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name = 0l );
~MechanicsView();
protected:
- virtual void dragEnterEvent( QDragEnterEvent * e );
+ virtual void dragEnterEvent( TQDragEnterEvent * e );
MechanicsDocument *m_pMechanicsDocument;
};