diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/node.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-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/node.cpp')
-rw-r--r-- | src/node.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/node.cpp b/src/node.cpp index 9a3531d..68002a2 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -16,10 +16,10 @@ #include <kdebug.h> -#include <qpainter.h> +#include <tqpainter.h> -Node::Node( ICNDocument *icnDocument, Node::node_type type, node_dir dir, const QPoint &pos, QString *id ) - : QObject(), QCanvasPolygon( icnDocument->canvas() ) +Node::Node( ICNDocument *icnDocument, Node::node_type type, node_dir dir, const TQPoint &pos, TQString *id ) + : TQObject(), TQCanvasPolygon( icnDocument->canvas() ) { p_nodeGroup = 0l; p_parentItem = 0L; @@ -28,7 +28,7 @@ Node::Node( ICNDocument *icnDocument, Node::node_type type, node_dir dir, const m_type = type; p_icnDocument = icnDocument; m_level = 0; - m_selectedColor = QColor( 101, 134, 192 ); + m_selectedColor = TQColor( 101, 134, 192 ); if (id) { @@ -36,12 +36,12 @@ Node::Node( ICNDocument *icnDocument, Node::node_type type, node_dir dir, const if ( !p_icnDocument->registerUID(*id) ) kdError() << k_funcinfo << "Could not register id " << *id << endl; } - else m_id = p_icnDocument->generateUID("node"+QString::number(type)); + else m_id = p_icnDocument->generateUID("node"+TQString::number(type)); initPoints(); move( pos.x(), pos.y() ); - setBrush( Qt::black ); - setPen( Qt::black ); + setBrush( TQt::black ); + setPen( TQt::black ); show(); emit (moved(this)); @@ -83,7 +83,7 @@ void Node::setVisible( bool yes ) if ( isVisible() == yes ) return; - QCanvasPolygon::setVisible(yes); + TQCanvasPolygon::tqsetVisible(yes); const ConnectorList::iterator inputEnd = m_inputConnectorList.end(); for ( ConnectorList::iterator it = m_inputConnectorList.begin(); it != inputEnd; ++it ) @@ -130,7 +130,7 @@ bool Node::isConnected( Node *node, NodeList *checkedNodes ) if (firstNode) checkedNodes = new NodeList(); - else if ( checkedNodes->contains(this) ) + else if ( checkedNodes->tqcontains(this) ) return false; @@ -199,20 +199,20 @@ void Node::initPoints() { if ( type() == ec_junction ) { - setPoints( QPointArray( QRect( -4, -4, 8, 8 ) ) ); + setPoints( TQPointArray( TQRect( -4, -4, 8, 8 ) ) ); return; } if ( type() == fp_junction ) { - setPoints( QPointArray( QRect( -4, -4, 9, 9 ) ) ); + setPoints( TQPointArray( TQRect( -4, -4, 9, 9 ) ) ); return; } const int length = ( type() == ec_pin ) ? 8 : -8; // Bounding rectangle, facing right - QPointArray pa( QRect( 0, -8, length, 16 ) ); + TQPointArray pa( TQRect( 0, -8, length, 16 ) ); double angle; if ( m_dir == Node::dir_up ) angle = -90.; @@ -225,14 +225,14 @@ void Node::initPoints() return; } - QWMatrix m; + TQWMatrix m; m.rotate(angle); pa = m.map(pa); setPoints(pa); } -QPoint Node::findConnectorDivergePoint( bool * found ) +TQPoint Node::findConnectorDivergePoint( bool * found ) { bool temp; if (!found) @@ -240,10 +240,10 @@ QPoint Node::findConnectorDivergePoint( bool * found ) *found = false; if ( numCon( false, false ) != 2 ) - return QPoint(0,0); + return TQPoint(0,0); - QPointList p1; - QPointList p2; + TQPointList p1; + TQPointList p2; int inSize = m_inputConnectorList.count(); @@ -270,7 +270,7 @@ QPoint Node::findConnectorDivergePoint( bool * found ) } } if ( !gotP1 || !gotP2 ) - return QPoint(0,0); + return TQPoint(0,0); unsigned maxLength = p1.size() > p2.size() ? p1.size() : p2.size(); @@ -282,24 +282,24 @@ QPoint Node::findConnectorDivergePoint( bool * found ) return p1[i-1]; } } - return QPoint(0, 0); + return TQPoint(0, 0); } -void Node::setParentItem( CNItem *parentItem ) +void Node::setParentItem( CNItem *tqparentItem ) { - if (!parentItem) + if (!tqparentItem) { - kdError() << k_funcinfo << "no parent item" << endl; + kdError() << k_funcinfo << "no tqparent item" << endl; return; } - p_parentItem = parentItem; + p_parentItem = tqparentItem; setLevel(p_parentItem->level()); - connect( p_parentItem, SIGNAL(movedBy(double, double )), this, SLOT(moveBy(double, double)) ); - connect( p_parentItem, SIGNAL(removed(Item*)), this, SLOT(removeNode(Item*)) ); + connect( p_parentItem, TQT_SIGNAL(movedBy(double, double )), this, TQT_SLOT(moveBy(double, double)) ); + connect( p_parentItem, TQT_SIGNAL(removed(Item*)), this, TQT_SLOT(removeNode(Item*)) ); } @@ -317,7 +317,7 @@ void Node::removeNode() void Node::moveBy( double dx, double dy ) { if ( dx == 0 && dy == 0 ) return; - QCanvasPolygon::moveBy( dx, dy ); + TQCanvasPolygon::moveBy( dx, dy ); emit moved(this); } @@ -387,15 +387,15 @@ bool Node::handleNewConnector( Connector * connector ) if (!connector) return false; - if ( m_inputConnectorList.contains(connector) || m_outputConnectorList.contains(connector) ) + if ( m_inputConnectorList.tqcontains(connector) || m_outputConnectorList.tqcontains(connector) ) { kdWarning() << k_funcinfo << " Already have connector = " << connector << endl; return false; } - connect( this, SIGNAL(removed(Node*)), connector, SLOT(removeConnector(Node*)) ); - connect( connector, SIGNAL(removed(Connector*)), this, SLOT(checkForRemoval(Connector*)) ); - connect( connector, SIGNAL(selected(bool)), this, SLOT(setNodeSelected(bool)) ); + connect( this, TQT_SIGNAL(removed(Node*)), connector, TQT_SLOT(removeConnector(Node*)) ); + connect( connector, TQT_SIGNAL(removed(Connector*)), this, TQT_SLOT(checkForRemoval(Connector*)) ); + connect( connector, TQT_SIGNAL(selected(bool)), this, TQT_SLOT(setNodeSelected(bool)) ); if ( !isChildNode() ) p_icnDocument->slotRequestAssignNG(); @@ -423,14 +423,14 @@ void Node::removeConnector( Connector *connector ) ConnectorList::iterator it; - it = m_inputConnectorList.find(connector); + it = m_inputConnectorList.tqfind(connector); if ( it != m_inputConnectorList.end() ) { (*it)->removeConnector(); (*it) = 0L; } - it = m_outputConnectorList.find(connector); + it = m_outputConnectorList.tqfind(connector); if ( it != m_outputConnectorList.end() ) { (*it)->removeConnector(); @@ -477,10 +477,10 @@ void Node::setNodeSelected( bool yes ) if ( isSelected() == yes ) return; - QCanvasItem::setSelected(yes); + TQCanvasItem::setSelected(yes); - setPen( yes ? m_selectedColor : Qt::black ); - setBrush( yes ? m_selectedColor : Qt::black ); + setPen( yes ? m_selectedColor : TQt::black ); + setBrush( yes ? m_selectedColor : TQt::black ); } #include "node.moc" |