summaryrefslogtreecommitdiffstats
path: root/src/picitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/picitem.cpp')
-rw-r--r--src/picitem.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/picitem.cpp b/src/picitem.cpp
index cbd7f1f..b5e0f03 100644
--- a/src/picitem.cpp
+++ b/src/picitem.cpp
@@ -19,7 +19,7 @@
#include <kdebug.h>
#include <kiconloader.h>
#include <klocale.h>
-#include <qpainter.h>
+#include <tqpainter.h>
static const int InnerWidth = 88;
static const int SidePadding = 24;
@@ -33,16 +33,16 @@ static const int PinDirArrow = 3;
//BEGIN class PinItem
-PinItem::PinItem( FlowCodeDocument* _view, QPoint position, bool _onLeft, PinSettings * pinSettings )
- : QCanvasRectangle(0)
+PinItem::PinItem( FlowCodeDocument* _view, TQPoint position, bool _onLeft, PinSettings * pinSettings )
+ : TQCanvasRectangle(0)
{
m_pinSettings = pinSettings;
view = _view;
onLeft = _onLeft;
- connect( m_pinSettings, SIGNAL(settingsChanged()), this, SLOT(updateDrawing()) );
+ connect( m_pinSettings, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(updateDrawing()) );
- if ( QFontInfo(m_font).pixelSize() > 11 ) // It has to be > 11, not > 12, as (I think) pixelSize() rounds off the actual size
+ if ( TQFontInfo(m_font).pixelSize() > 11 ) // It has to be > 11, not > 12, as (I think) pixelSize() rounds off the actual size
m_font.setPixelSize(12);
setCanvas( view->canvas() );
@@ -69,13 +69,13 @@ void PinItem::initItem()
{
setSize( PinLength, PinWidth );
setSelected(false);
- setPen( Qt::black );
+ setPen( TQt::black );
calcTextRect();
show();
}
-void PinItem::drawShape( QPainter& p )
+void PinItem::drawShape( TQPainter& p )
{
if (!m_pinSettings)
return;
@@ -83,23 +83,23 @@ void PinItem::drawShape( QPainter& p )
if ( m_pinSettings->state() == PinSettings::ps_on )
{
if ( m_pinSettings->type() == PinSettings::pt_output )
- setBrush( QColor( 255, 127, 127 ) );
+ setBrush( TQColor( 255, 127, 127 ) );
else
- setBrush( QColor( 255, 191, 191 ) );
+ setBrush( TQColor( 255, 191, 191 ) );
}
else
- setBrush( Qt::white );
+ setBrush( TQt::white );
p.drawRect(rect());
p.setFont(m_font);
- p.setBrush( Qt::NoBrush );
- QRect r = m_textRect;
+ p.setBrush( TQt::NoBrush );
+ TQRect r = m_textRect;
if ( onLeft )
- p.drawText( r, Qt::AlignLeft, m_pinSettings->id() );
+ p.drawText( r, TQt::AlignLeft, m_pinSettings->id() );
else
- p.drawText( r, Qt::AlignRight, m_pinSettings->id() );
- QRect br = p.boundingRect( r, Qt::AlignLeft, m_pinSettings->id() );
+ p.drawText( r, TQt::AlignRight, m_pinSettings->id() );
+ TQRect br = p.boundingRect( r, TQt::AlignLeft, m_pinSettings->id() );
int left;
int right;
@@ -115,7 +115,7 @@ void PinItem::drawShape( QPainter& p )
}
int midY = (int)y() + PinWidth/2;
- QPointArray pa(3);
+ TQPointArray pa(3);
int midLeft = left + (8-PinDirArrow)/2;
int midRight = left + (8+PinDirArrow)/2;
@@ -130,32 +130,32 @@ void PinItem::drawShape( QPainter& p )
midRight++;
}
- p.setBrush( Qt::black );
+ p.setBrush( TQt::black );
// Right facing arrow
if ( (m_pinSettings->type() == PinSettings::pt_input && onLeft) ||
(m_pinSettings->type() == PinSettings::pt_output && !onLeft) )
{
- pa[0] = QPoint::QPoint( midRight, midY );
- pa[1] = QPoint::QPoint( midLeft, midY - PinDirArrow );
- pa[2] = QPoint::QPoint( midLeft, midY + PinDirArrow );
+ pa[0] = TQPoint::TQPoint( midRight, midY );
+ pa[1] = TQPoint::TQPoint( midLeft, midY - PinDirArrow );
+ pa[2] = TQPoint::TQPoint( midLeft, midY + PinDirArrow );
p.drawPolygon(pa);
p.drawLine ( left, midY, right, midY );
}
else // Left facing arrow
{
- pa[0] = QPoint::QPoint( midLeft, midY );
- pa[1] = QPoint::QPoint( midRight, midY - PinDirArrow );
- pa[2] = QPoint::QPoint( midRight, midY + PinDirArrow );
+ pa[0] = TQPoint::TQPoint( midLeft, midY );
+ pa[1] = TQPoint::TQPoint( midRight, midY - PinDirArrow );
+ pa[2] = TQPoint::TQPoint( midRight, midY + PinDirArrow );
p.drawPolygon(pa);
p.drawLine ( left, midY, right, midY );
}
}
-QRect PinItem::boundingRect () const
+TQRect PinItem::boundingRect () const
{
- QRect r = m_textRect;
+ TQRect r = m_textRect;
if ( onLeft )
r.setLeft( (int)x() - 10 );
else
@@ -165,7 +165,7 @@ QRect PinItem::boundingRect () const
}
-QString PinItem::id()
+TQString PinItem::id()
{
return m_pinSettings->id();
}
@@ -198,7 +198,7 @@ void PinItem::dragged( int dx )
void PinItem::moveBy ( double dx, double dy )
{
- QCanvasRectangle::moveBy( dx, dy );
+ TQCanvasRectangle::moveBy( dx, dy );
calcTextRect();
}
@@ -207,10 +207,10 @@ void PinItem::calcTextRect()
{
m_textRect = rect();
m_textRect.moveTop( m_textRect.top()-2 );
- QRect br;
+ TQRect br;
- QWidget tmpWidget;
- QPainter p(&tmpWidget);
+ TQWidget tmpWidget;
+ TQPainter p(&tmpWidget);
p.setFont(m_font);
@@ -223,13 +223,13 @@ void PinItem::calcTextRect()
{
m_textRect.setLeft( (int)x() + PinLength + 2 );
m_textRect.setRight( (int)x() + InnerWidth/2 );
- br = p.boundingRect( m_textRect, Qt::AlignLeft, m_pinSettings->id() );
+ br = p.boundingRect( m_textRect, TQt::AlignLeft, m_pinSettings->id() );
}
else
{
m_textRect.setLeft( m_textRect.right() - InnerWidth/2 );
m_textRect.setRight( (int)x() - 2 );
- br = p.boundingRect( m_textRect, Qt::AlignRight, m_pinSettings->id() );
+ br = p.boundingRect( m_textRect, TQt::AlignRight, m_pinSettings->id() );
}
}
//END class PinItem
@@ -253,33 +253,33 @@ PicItem::PicItem( ICNDocument *icnDocument, bool newItem, const char *id, MicroS
m_innerHeight = (numSide+2)*PinWidth + (numSide-1)*PinSeparation;
updateVisibility();
- addButton( "settings", QRect( SidePadding-8, m_innerHeight+TopPadding+(BottomPadding-24)/2-1, InnerWidth+16, 24 ), i18n("Advanced...") );
- addButton( "expandBtn", QRect( (TopPadding-22)/2, (TopPadding-22)/2, 22, 22 ), KGlobal::iconLoader()->loadIcon( "down", KIcon::Small ), true );
+ addButton( "settings", TQRect( SidePadding-8, m_innerHeight+TopPadding+(BottomPadding-24)/2-1, InnerWidth+16, 24 ), i18n("Advanced...") );
+ addButton( "expandBtn", TQRect( (TopPadding-22)/2, (TopPadding-22)/2, 22, 22 ), KGlobal::iconLoader()->loadIcon( "down", KIcon::Small ), true );
button("expandBtn")->setState(true);
move( 12, 12 );
- QStringList pinIDs = microSettings->microInfo()->package()->pinIDs( PicPin::type_bidir | PicPin::type_input | PicPin::type_open );
- QStringList::iterator it = pinIDs.begin();
+ TQStringList pinIDs = microSettings->microInfo()->package()->pinIDs( PicPin::type_bidir | PicPin::type_input | PicPin::type_open );
+ TQStringList::iterator it = pinIDs.begin();
for ( int i=0; i < numSide; ++i, ++it )
{
- QPoint position( int(this->x()) + SidePadding - PinLength+1, int(y()) + TopPadding + (i+1)*PinWidth + i*PinSeparation );
- const QString id = *it;
+ TQPoint position( int(this->x()) + SidePadding - PinLength+1, int(y()) + TopPadding + (i+1)*PinWidth + i*PinSeparation );
+ const TQString id = *it;
PinSettings *settings = microSettings->pinWithID(id);
m_pinItemList.append( new PinItem( dynamic_cast<FlowCodeDocument*>(icnDocument), position, true, settings ) );
}
for ( int i=0; i < numPins/2; ++i, ++it )
{
- QPoint position( int(this->x()) + SidePadding + InnerWidth-1, int(y()) + TopPadding + m_innerHeight - ( (i+2)*PinWidth + i*PinSeparation ) );
- const QString id = *it;
+ TQPoint position( int(this->x()) + SidePadding + InnerWidth-1, int(y()) + TopPadding + m_innerHeight - ( (i+2)*PinWidth + i*PinSeparation ) );
+ const TQString id = *it;
PinSettings *settings = microSettings->pinWithID(id);
m_pinItemList.append( new PinItem( dynamic_cast<FlowCodeDocument*>(icnDocument), position, false, settings ) );
}
setSelected(false);
- setPen( Qt::black );
+ setPen( TQt::black );
updateZ(-1);
update();
show();
@@ -305,24 +305,24 @@ void PicItem::updateZ( int baseZ )
}
-void PicItem::drawShape( QPainter & p )
+void PicItem::drawShape( TQPainter & p )
{
int _x = int(x());
int _y = int(y());
- p.setBrush( QColor( 0xef, 0xff, 0xef ) );
+ p.setBrush( TQColor( 0xef, 0xff, 0xef ) );
p.setFont( font() );
p.drawRoundRect( _x, _y, width(), height(), 2000/width(), 2000/height() );
- p.drawText( _x+TopPadding-2, _y, width()-TopPadding+2, TopPadding, Qt::AlignVCenter, i18n("PIC Settings") );
+ p.drawText( _x+TopPadding-2, _y, width()-TopPadding+2, TopPadding, TQt::AlignVCenter, i18n("PIC Settings") );
if ( !m_bExpanded )
return;
// Draw rectangle to cut off pins
- p.setBrush( QColor( 239, 255, 255 ) );
- QRect r( _x+SidePadding, _y+TopPadding, InnerWidth, m_innerHeight );
+ p.setBrush( TQColor( 239, 255, 255 ) );
+ TQRect r( _x+SidePadding, _y+TopPadding, InnerWidth, m_innerHeight );
p.drawRect(r);
// Draw dimple thingy at end of pic
@@ -331,15 +331,15 @@ void PicItem::drawShape( QPainter & p )
// Draw vertical text centered in PIC
p.translate( r.width()/2 + r.x(), r.height()/2 + r.y() );
p.rotate(90);
- QRect textRect( r.width()/-2, r.height()/-2, r.width(), r.height() );
- p.drawText( textRect, Qt::AlignCenter, microSettings->microInfo()->id() );
+ TQRect textRect( r.width()/-2, r.height()/-2, r.width(), r.height() );
+ p.drawText( textRect, TQt::AlignCenter, microSettings->microInfo()->id() );
p.rotate(-90);
p.translate( r.width()/-2 - r.x(), r.height()/-2 - r.y() );
}
-void PicItem::buttonStateChanged( const QString &id, bool state )
+void PicItem::buttonStateChanged( const TQString &id, bool state )
{
if ( id == "expandBtn" )
{
@@ -357,8 +357,8 @@ void PicItem::buttonStateChanged( const QString &id, bool state )
update();
MicroSettingsDlg *dlg = new MicroSettingsDlg( microSettings, 0L, "microSettingsDlg" );
- connect( dlg, SIGNAL(okClicked()), this, SLOT(slotMicroSettingsDlgAccepted()) );
- connect( dlg, SIGNAL(applyClicked()), this, SLOT(slotMicroSettingsDlgAccepted()) );
+ connect( dlg, TQT_SIGNAL(okClicked()), this, TQT_SLOT(slotMicroSettingsDlgAccepted()) );
+ connect( dlg, TQT_SIGNAL(applyClicked()), this, TQT_SLOT(slotMicroSettingsDlgAccepted()) );
dlg->show();
// At this point the PIC is selected but this does not appear to the
// user so we must deselect it when done.
@@ -377,10 +377,10 @@ void PicItem::updateVisibility()
const PinItemList::iterator end = m_pinItemList.end();
for ( PinItemList::iterator it = m_pinItemList.begin(); it != end; ++it )
- (*it)->setVisible(m_bExpanded);
+ (*it)->tqsetVisible(m_bExpanded);
if ( Button * btn = button("settings") )
- btn->setVisible(m_bExpanded);
+ btn->tqsetVisible(m_bExpanded);
}