summaryrefslogtreecommitdiffstats
path: root/src/itemlibrary.cpp
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/itemlibrary.cpp
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/itemlibrary.cpp')
-rw-r--r--src/itemlibrary.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/itemlibrary.cpp b/src/itemlibrary.cpp
index d749f7f..9905372 100644
--- a/src/itemlibrary.cpp
+++ b/src/itemlibrary.cpp
@@ -104,12 +104,12 @@
#include "kdebug.h"
#include <kiconloader.h>
-#include <qbitmap.h>
-#include <qimage.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qpushbutton.h>
-#include <qregexp.h>
+#include <tqbitmap.h>
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpushbutton.h>
+#include <tqregexp.h>
#include <cassert>
@@ -289,7 +289,7 @@ void ItemLibrary::addLibraryItem( LibraryItem *item )
}
-Item *ItemLibrary::createItem( const QString &id, ItemDocument *itemDocument, bool newItem, const char *newId, bool finishCreation )
+Item *ItemLibrary::createItem( const TQString &id, ItemDocument *itemDocument, bool newItem, const char *newId, bool finishCreation )
{
Item * item = 0l;
if ( id.startsWith("sc/") )
@@ -303,7 +303,7 @@ Item *ItemLibrary::createItem( const QString &id, ItemDocument *itemDocument, bo
return 0l;
}
- QString temp = id;
+ TQString temp = id;
int numId = temp.remove("sc/").toInt();
item = subcircuits()->createSubcircuit( numId, /*id,*/ circuitDocument, newItem, newId );
@@ -315,7 +315,7 @@ Item *ItemLibrary::createItem( const QString &id, ItemDocument *itemDocument, bo
LibraryItemList::iterator it = m_items.begin();
for ( ; it != end; ++it )
{
- if ( (*it)->allIDs().contains(id) )
+ if ( (*it)->allIDs().tqcontains(id) )
{
item = (*it)->createItemFnPtr()( itemDocument, newItem, newId );
item->m_type = (*it)->activeID();
@@ -334,11 +334,11 @@ Item *ItemLibrary::createItem( const QString &id, ItemDocument *itemDocument, bo
}
-QImage ItemLibrary::itemImage( Item *item, const uint maxSize )
+TQImage ItemLibrary::itemImage( Item *item, const uint maxSize )
{
Component *component = dynamic_cast<Component*>(item);
- QRect bound = item->boundingRect().normalize();
+ TQRect bound = item->boundingRect().normalize();
bound.setLeft( bound.left()-8 );
bound.setRight( bound.right()+8 );
bound.setTop( bound.top()-8 );
@@ -358,30 +358,30 @@ QImage ItemLibrary::itemImage( Item *item, const uint maxSize )
}
const bool cache = ((bound.width()*bound.height()) > (int)maxSize);
- QString type;
- if ( cache && m_imageMap.contains(item->type()) )
+ TQString type;
+ if ( cache && m_imageMap.tqcontains(item->type()) )
return m_imageMap[item->type()];
// Create pixmap big enough to contain CNItem and surrounding nodes
// and copy the button grab to it
- QPixmap pm( bound.size() );
+ TQPixmap pm( bound.size() );
- QBitmap mask( bound.size() );
- mask.fill( Qt::color0 );
+ TQBitmap tqmask( bound.size() );
+ tqmask.fill( TQt::color0 );
- QPainter maskPainter(&mask);
- maskPainter.translate( -bound.x(), -bound.y() );
- maskPainter.setPen( Qt::color1 );
- maskPainter.setBrush( Qt::color1 );
+ TQPainter tqmaskPainter(&tqmask);
+ tqmaskPainter.translate( -bound.x(), -bound.y() );
+ tqmaskPainter.setPen( TQt::color1 );
+ tqmaskPainter.setBrush( TQt::color1 );
- QPainter p(&pm);
+ TQPainter p(&pm);
p.translate( -bound.x(), -bound.y() );
p.setPen( item->pen() );
p.setBrush( item->brush() );
- // Now draw the shape :-)
+ // Now draw the tqshape :-)
const bool sel = item->isSelected();
if (sel)
{
@@ -391,7 +391,7 @@ QImage ItemLibrary::itemImage( Item *item, const uint maxSize )
item->blockSignals(false);
}
item->drawShape(p);
- item->drawShape(maskPainter);
+ item->drawShape(tqmaskPainter);
if (sel)
{
item->blockSignals(true);
@@ -399,10 +399,10 @@ QImage ItemLibrary::itemImage( Item *item, const uint maxSize )
item->blockSignals(false);
}
- maskPainter.setPen( Qt::color1 );
- maskPainter.setBrush( Qt::color1 );
+ tqmaskPainter.setPen( TQt::color1 );
+ tqmaskPainter.setBrush( TQt::color1 );
- QWMatrix transMatrix; // Matrix to apply to the image
+ TQWMatrix transMatrix; // Matrix to apply to the image
CNItem *cnItem = dynamic_cast<CNItem*>(item);
if (cnItem)
@@ -420,41 +420,41 @@ QImage ItemLibrary::itemImage( Item *item, const uint maxSize )
const bool showVB = ecnode->showVoltageBars();
ecnode->setShowVoltageBars(false);
ecnode->drawShape(p);
- ecnode->drawShape(maskPainter);
+ ecnode->drawShape(tqmaskPainter);
ecnode->setShowVoltageBars(showVB);
}
else
{
node->drawShape(p);
- node->drawShape(maskPainter);
+ node->drawShape(tqmaskPainter);
}
if (sel)
node->setSelected(sel);
}
- p.setPen(Qt::black);
+ p.setPen(TQt::black);
TextMap text = cnItem->textMap();
const TextMap::iterator textEnd = text.end();
for ( TextMap::iterator it = text.begin(); it != textEnd; ++it )
{
it.data()->drawShape(p);
- it.data()->drawShape(maskPainter);
+ it.data()->drawShape(tqmaskPainter);
}
-// maskPainter.setPen( Qt::color1 );
-// maskPainter.setBrush( Qt::color1 );
+// tqmaskPainter.setPen( TQt::color1 );
+// tqmaskPainter.setBrush( TQt::color1 );
cnItem->drawWidgets(p);
-// cnItem->drawWidgets(maskPainter);
+// cnItem->drawWidgets(tqmaskPainter);
transMatrix = Component::transMatrix( component->angleDegrees(), component->flipped(), bound.width()/2, bound.height()/2, true );
}
- pm.setMask(mask);
+ pm.setMask(tqmask);
// Now, rotate the image so that it's the right way up, and scale it to size
- QImage im = pm.convertToImage();
+ TQImage im = pm.convertToImage();
im = im.xForm(transMatrix);
- im = im.smoothScale( 50, 50, QImage::ScaleMin );
+ im = im.smoothScale( 50, 50, TQ_ScaleMin );
if (cache)
m_imageMap[item->type()] = im;
@@ -462,15 +462,15 @@ QImage ItemLibrary::itemImage( Item *item, const uint maxSize )
return im;
}
-QPixmap ItemLibrary::itemIconFull( const QString &id )
+TQPixmap ItemLibrary::itemIconFull( const TQString &id )
{
LibraryItemList::iterator end = m_items.end();
for ( LibraryItemList::iterator it = m_items.begin(); it != end; ++it )
{
- if ( *it && (*it)->allIDs().contains(id) )
+ if ( *it && (*it)->allIDs().tqcontains(id) )
{
return (*it)->iconFull();
}
}
- return QPixmap();
+ return TQPixmap();
}