diff options
Diffstat (limited to 'src/itemdocument.cpp')
-rw-r--r-- | src/itemdocument.cpp | 294 |
1 files changed, 147 insertions, 147 deletions
diff --git a/src/itemdocument.cpp b/src/itemdocument.cpp index cfe3230..0556552 100644 --- a/src/itemdocument.cpp +++ b/src/itemdocument.cpp @@ -32,16 +32,16 @@ #include <kmessagebox.h> #include <kpopupmenu.h> #include <kprinter.h> -#include <qcheckbox.h> -#include <qclipboard.h> -#include <qcursor.h> -#include <qimage.h> -#include <qpaintdevicemetrics.h> -#include <qpainter.h> -#include <qpicture.h> -#include <qregexp.h> -#include <qsimplerichtext.h> -#include <qtimer.h> +#include <tqcheckbox.h> +#include <tqclipboard.h> +#include <tqcursor.h> +#include <tqimage.h> +#include <tqpaintdevicemetrics.h> +#include <tqpainter.h> +#include <tqpicture.h> +#include <tqregexp.h> +#include <tqsimplerichtext.h> +#include <tqtimer.h> #include <cmath> @@ -49,7 +49,7 @@ //BEGIN class ItemDocument int ItemDocument::m_nextActionTicket = 0; -ItemDocument::ItemDocument( const QString &caption, KTechlab *ktechlab, const char *name) +ItemDocument::ItemDocument( const TQString &caption, KTechlab *ktechlab, const char *name) : Document( caption, ktechlab, name ) { m_queuedEvents = 0; @@ -69,16 +69,16 @@ ItemDocument::ItemDocument( const QString &caption, KTechlab *ktechlab, const ch m_canvas->resize( 0, 0 ); m_canvas->setDoubleBuffering(true); - m_pEventTimer = new QTimer(this); - connect( m_pEventTimer, SIGNAL(timeout()), this, SLOT(processItemDocumentEvents()) ); + m_pEventTimer = new TQTimer(this); + connect( m_pEventTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(processItemDocumentEvents()) ); - connect( this, SIGNAL(itemSelected(Item*)), this, SLOT(slotInitItemActions(Item*)) ); - connect( this, SIGNAL(itemUnselected(Item*)), this, SLOT(slotInitItemActions(Item*)) ); + connect( this, TQT_SIGNAL(itemSelected(Item*)), this, TQT_SLOT(slotInitItemActions(Item*)) ); + connect( this, TQT_SIGNAL(itemUnselected(Item*)), this, TQT_SLOT(slotInitItemActions(Item*)) ); - connect( ComponentSelector::self(), SIGNAL(itemClicked(const QString& )), this, SLOT(slotUnsetRepeatedItemId()) ); - connect( FlowPartSelector::self(), SIGNAL(itemClicked(const QString& )), this, SLOT(slotUnsetRepeatedItemId()) ); + connect( ComponentSelector::self(), TQT_SIGNAL(itemClicked(const TQString& )), this, TQT_SLOT(slotUnsetRepeatedItemId()) ); + connect( FlowPartSelector::self(), TQT_SIGNAL(itemClicked(const TQString& )), this, TQT_SLOT(slotUnsetRepeatedItemId()) ); #ifdef MECHANICS - connect( MechanicsSelector::self(), SIGNAL(itemClicked(const QString& )), this, SLOT(slotUnsetRepeatedItemId()) ); + connect( MechanicsSelector::self(), TQT_SIGNAL(itemClicked(const TQString& )), this, TQT_SLOT(slotUnsetRepeatedItemId()) ); #endif m_pAlignmentAction = new KActionMenu( i18n("Alignment"), "rightjust", this ); @@ -112,7 +112,7 @@ void ItemDocument::handleNewView( View * view ) } -bool ItemDocument::registerItem( QCanvasItem *qcanvasItem ) +bool ItemDocument::registerItem( TQCanvasItem *qcanvasItem ) { if (!qcanvasItem) return false; @@ -126,9 +126,9 @@ bool ItemDocument::registerItem( QCanvasItem *qcanvasItem ) { Item *item = dynamic_cast<Item*>(qcanvasItem); m_itemList.append(item); - connect( item, SIGNAL(removed(Item*)), this, SLOT(requestRerouteInvalidatedConnectors()) ); - connect( item, SIGNAL(selected(Item*,bool)), this, SIGNAL(itemSelected(Item*)) ); - connect( item, SIGNAL(unselected(Item*,bool)), this, SIGNAL(itemUnselected(Item*)) ); + connect( item, TQT_SIGNAL(removed(Item*)), this, TQT_SLOT(requestRerouteInvalidatedConnectors()) ); + connect( item, TQT_SIGNAL(selected(Item*,bool)), this, TQT_SIGNAL(itemSelected(Item*)) ); + connect( item, TQT_SIGNAL(unselected(Item*,bool)), this, TQT_SIGNAL(itemUnselected(Item*)) ); itemAdded(item); return true; } @@ -150,7 +150,7 @@ void ItemDocument::cancelCurrentOperation() } -void ItemDocument::slotSetRepeatedItemId( const QString &id ) +void ItemDocument::slotSetRepeatedItemId( const TQString &id ) { m_cmManager->setCMState( CMManager::cms_repeated_add, true ); m_cmManager->setRepeatedAddId(id); @@ -202,7 +202,7 @@ bool ItemDocument::openURL( const KURL &url ) return false; // Why do we stop simulating while loading a document? - // Crash possible when loading a circuit document, and the Qt event loop is + // Crash possible when loading a circuit document, and the TQt event loop is // reentered (such as when a PIC component pops-up a message box), which // will then call the Simulator::step function, which might use components // that have not fully initialized themselves. @@ -232,7 +232,7 @@ bool ItemDocument::openURL( const KURL &url ) ItemList::iterator end = m_itemList.end(); for ( ItemList::iterator it = m_itemList.begin(); it != end; ++it ) { - if ( !*it || (*it)->parentItem() ) + if ( !*it || (*it)->tqparentItem() ) continue; m_zOrder[(*it)->baseZ()] = *it; @@ -249,26 +249,26 @@ void ItemDocument::print() if ( ! printer->setup( p_ktechlab ) ) return; - // setup the printer. with Qt, you always "print" to a - // QPainter.. whether the output medium is a pixmap, a screen, + // setup the printer. with TQt, you always "print" to a + // TQPainter.. whether the output medium is a pixmap, a screen, // or paper - QPainter p; + TQPainter p; p.begin( printer ); // we let our view do the actual printing - QPaintDeviceMetrics metrics( printer ); + TQPaintDeviceMetrics metrics( printer ); // Round to 16 (= 2 * 8) so that we cut in the middle of squares int w = 16*int(metrics.width()/16); int h = 16*int(metrics.height()/16); p.setClipping( true ); - p.setClipRect( 0, 0, w, h, QPainter::CoordPainter ); + p.setClipRect( 0, 0, w, h, TQPainter::CoordPainter ); // Send off the painter for drawing - m_canvas->setBackgroundPixmap( 0 ); + m_canvas->tqsetBackgroundPixmap( 0 ); - QRect bounding = canvasBoundingRect(); + TQRect bounding = canvasBoundingRect(); unsigned int rows = (unsigned) std::ceil( double( bounding.height() ) / double( h ) ); unsigned int cols = (unsigned) std::ceil( double( bounding.width() ) / double( w ) ); int offset_x = bounding.x(); @@ -281,7 +281,7 @@ void ItemDocument::print() if ( row != 0 || col != 0 ) printer->newPage(); - QRect drawArea( offset_x + (col * w), offset_y + (row * h), w, h ); + TQRect drawArea( offset_x + (col * w), offset_y + (row * h), w, h ); m_canvas->drawArea( drawArea, & p ); p.translate( -w, 0 ); @@ -406,7 +406,7 @@ void ItemDocument::cut() void ItemDocument::paste() { - QString xml = KApplication::clipboard()->text( QClipboard::Clipboard ); + TQString xml = KApplication::tqclipboard()->text( TQClipboard::Clipboard ); if ( xml.isEmpty() ) return; @@ -425,7 +425,7 @@ void ItemDocument::paste() } -Item *ItemDocument::itemWithID( const QString &id ) +Item *ItemDocument::itemWithID( const TQString &id ) { const ItemList::iterator end = m_itemList.end(); for ( ItemList::iterator it = m_itemList.begin(); it != end; ++it ) @@ -443,27 +443,27 @@ void ItemDocument::unselectAll() } -void ItemDocument::select( QCanvasItem * item ) +void ItemDocument::select( TQCanvasItem * item ) { if (!item) return; - item->setSelected( selectList()->contains( item ) || selectList()->addQCanvasItem( item ) ); + item->setSelected( selectList()->tqcontains( item ) || selectList()->addTQCanvasItem( item ) ); } -void ItemDocument::select( const QCanvasItemList & list ) +void ItemDocument::select( const TQCanvasItemList & list ) { - const QCanvasItemList::const_iterator end = list.end(); - for ( QCanvasItemList::const_iterator it = list.begin(); it != end; ++it ) - selectList()->addQCanvasItem(*it); + const TQCanvasItemList::const_iterator end = list.end(); + for ( TQCanvasItemList::const_iterator it = list.begin(); it != end; ++it ) + selectList()->addTQCanvasItem(*it); selectList()->setSelected(true); } -void ItemDocument::unselect( QCanvasItem *qcanvasItem ) +void ItemDocument::unselect( TQCanvasItem *qcanvasItem ) { - selectList()->removeQCanvasItem(qcanvasItem); + selectList()->removeTQCanvasItem(qcanvasItem); qcanvasItem->setSelected(false); } @@ -475,26 +475,26 @@ void ItemDocument::slotUpdateConfiguration() } -QCanvasItem* ItemDocument::itemAtTop( const QPoint &pos ) const +TQCanvasItem* ItemDocument::itemAtTop( const TQPoint &pos ) const { - QCanvasItemList list = m_canvas->collisions( QRect( pos.x()-1, pos.y()-1, 3, 3 ) ); + TQCanvasItemList list = m_canvas->collisions( TQRect( pos.x()-1, pos.y()-1, 3, 3 ) ); - QCanvasItemList::const_iterator it = list.begin(); - const QCanvasItemList::const_iterator end = list.end(); + TQCanvasItemList::const_iterator it = list.begin(); + const TQCanvasItemList::const_iterator end = list.end(); while ( it != end ) { - QCanvasItem *item = *it; + TQCanvasItem *item = *it; if ( item == m_canvasTip || - item->rtti() == QCanvasItem::Rtti_Line || - item->rtti() == QCanvasItem::Rtti_Text || - item->rtti() == QCanvasItem::Rtti_Rectangle ) + item->rtti() == TQCanvasItem::Rtti_Line || + item->rtti() == TQCanvasItem::Rtti_Text || + item->rtti() == TQCanvasItem::Rtti_Rectangle ) { ++it; } else { if ( item->rtti() == ItemDocument::RTTI::ConnectorLine ) - return (static_cast<ConnectorLine*>(item))->parent(); + return (static_cast<ConnectorLine*>(item))->tqparent(); return item; } @@ -531,9 +531,9 @@ void ItemDocument::distributeVertically( ) } -bool ItemDocument::registerUID( const QString &UID ) +bool ItemDocument::registerUID( const TQString &UID ) { - if ( m_idList.findIndex(UID) == -1 ) + if ( m_idList.tqfindIndex(UID) == -1 ) { m_idList.append(UID); return true; @@ -543,24 +543,24 @@ bool ItemDocument::registerUID( const QString &UID ) } -void ItemDocument::unregisterUID( const QString & uid ) +void ItemDocument::unregisterUID( const TQString & uid ) { m_idList.remove(uid); } -QString ItemDocument::generateUID( QString name ) +TQString ItemDocument::generateUID( TQString name ) { - name.remove( QRegExp("__.*") ); // Change 'node__13' to 'node', for example - QString idAttempt = name; -// if ( idAttempt.find("__") != -1 ) idAttempt.truncate( idAttempt.find("__") ); - while ( !registerUID(idAttempt) ) { idAttempt = name + "__" + QString::number(m_nextIdNum++); } + name.remove( TQRegExp("__.*") ); // Change 'node__13' to 'node', for example + TQString idAttempt = name; +// if ( idAttempt.tqfind("__") != -1 ) idAttempt.truncate( idAttempt.tqfind("__") ); + while ( !registerUID(idAttempt) ) { idAttempt = name + "__" + TQString::number(m_nextIdNum++); } return idAttempt; } -void ItemDocument::canvasRightClick( const QPoint &pos, QCanvasItem* item ) +void ItemDocument::canvasRightClick( const TQPoint &pos, TQCanvasItem* item ) { if (item) { @@ -572,12 +572,12 @@ void ItemDocument::canvasRightClick( const QPoint &pos, QCanvasItem* item ) } } - p_ktechlab->unplugActionList("alignment_actionlist"); + p_ktechlab->unplugActionList("tqalignment_actionlist"); p_ktechlab->unplugActionList("orientation_actionlist"); p_ktechlab->unplugActionList("component_actionlist"); fillContextMenu(pos); - QPopupMenu *pop = static_cast<QPopupMenu*>(p_ktechlab->factory()->container("item_popup", p_ktechlab)); + TQPopupMenu *pop = static_cast<TQPopupMenu*>(p_ktechlab->factory()->container("item_popup", p_ktechlab)); if (!pop) return; @@ -586,7 +586,7 @@ void ItemDocument::canvasRightClick( const QPoint &pos, QCanvasItem* item ) } -void ItemDocument::fillContextMenu( const QPoint & pos ) +void ItemDocument::fillContextMenu( const TQPoint & pos ) { Q_UNUSED(pos); @@ -611,9 +611,9 @@ void ItemDocument::fillContextMenu( const QPoint & pos ) m_pAlignmentAction->remove( align_actions[i] ); m_pAlignmentAction->insert( align_actions[i] ); } - QPtrList<KAction> alignment_actions; - alignment_actions.append( m_pAlignmentAction ); - p_ktechlab->plugActionList( "alignment_actionlist", alignment_actions ); + TQPtrList<KAction> tqalignment_actions; + tqalignment_actions.append( m_pAlignmentAction ); + p_ktechlab->plugActionList( "tqalignment_actionlist", tqalignment_actions ); } @@ -656,12 +656,12 @@ void ItemDocument::updateBackground() int interval = 8; int bigness = interval * 10; - QPixmap pm( bigness, bigness ); + TQPixmap pm( bigness, bigness ); // pm.fill( KTLConfig::bgColor() ); // first fill the background colour in - pm.fill( Qt::white ); + pm.fill( TQt::white ); if( KTLConfig::showGrid() ){ - QPainter p(&pm); // setup painter to draw on pixmap + TQPainter p(&pm); // setup painter to draw on pixmap p.setPen( KTLConfig::gridColor() ); // set forecolour // note: anything other than 8 borks this for( int i = (interval / 2); i < bigness; i+=interval ){ @@ -671,8 +671,8 @@ void ItemDocument::updateBackground() p.end(); // all done } - pm.setDefaultOptimization( QPixmap::BestOptim ); - m_canvas->setBackgroundPixmap(pm); // and the finale. + pm.setDefaultOptimization( TQPixmap::BestOptim ); + m_canvas->tqsetBackgroundPixmap(pm); // and the finale. } @@ -710,8 +710,8 @@ void ItemDocument::resizeCanvasToItems() { const ViewList::iterator end = m_viewList.end(); - QRect bound = canvasBoundingRect(); - QSize size( bound.right(), bound.bottom() ); + TQRect bound = canvasBoundingRect(); + TQSize size( bound.right(), bound.bottom() ); m_viewList.remove((View*)0); @@ -732,7 +732,7 @@ void ItemDocument::resizeCanvasToItems() if ( (contentsY - contentsWMY) == 1 ) contentsWMY = contentsY; - size = size.expandedTo( QSize( contentsWMX, contentsWMY ) ); + size = size.expandedTo( TQSize( contentsWMX, contentsWMY ) ); } // We want to avoid flicker.... @@ -741,8 +741,8 @@ void ItemDocument::resizeCanvasToItems() ItemView * itemView = static_cast<ItemView*>((View*)*it); CVBEditor * cvbEditor = itemView->cvbEditor(); - cvbEditor->setVScrollBarMode( ((size.height()*itemView->zoomLevel()) > cvbEditor->visibleHeight()) ? QScrollView::AlwaysOn : QScrollView::AlwaysOff ); - cvbEditor->setHScrollBarMode( ((size.width()*itemView->zoomLevel()) > cvbEditor->visibleWidth()) ? QScrollView::AlwaysOn : QScrollView::AlwaysOff ); + cvbEditor->setVScrollBarMode( ((size.height()*itemView->zoomLevel()) > cvbEditor->visibleHeight()) ? TQScrollView::AlwaysOn : TQScrollView::AlwaysOff ); + cvbEditor->setHScrollBarMode( ((size.width()*itemView->zoomLevel()) > cvbEditor->visibleWidth()) ? TQScrollView::AlwaysOn : TQScrollView::AlwaysOff ); } bool changedSize = canvas()->size() != size; @@ -755,13 +755,13 @@ void ItemDocument::resizeCanvasToItems() } -QRect ItemDocument::canvasBoundingRect() const +TQRect ItemDocument::canvasBoundingRect() const { - QRect bound; + TQRect bound; - const QCanvasItemList allItems = canvas()->allItems(); - const QCanvasItemList::const_iterator end = allItems.end(); - for ( QCanvasItemList::const_iterator it = allItems.begin(); it != end; ++it ) + const TQCanvasItemList allItems = canvas()->allItems(); + const TQCanvasItemList::const_iterator end = allItems.end(); + for ( TQCanvasItemList::const_iterator it = allItems.begin(); it != end; ++it ) { if ( !(*it)->isVisible() ) continue; @@ -790,9 +790,9 @@ void ItemDocument::exportToImage() // widget for the kfiledialog // It is the bit that says "Crop circuit?" // Okay need to think of something way better to say here. - // gotme here, KFileDialog makes itself parent so tries to destroy cropCheck when it is deleted. + // gotme here, KFileDialog makes itself tqparent so tries to destroy cropCheck when it is deleted. // therefore we use a pointer. - QString cropMessage; + TQString cropMessage; if ( type() == Document::dt_flowcode ) cropMessage = i18n("Crop image to program parts"); @@ -802,42 +802,42 @@ void ItemDocument::exportToImage() else cropMessage = i18n("Crop image"); - QCheckBox *cropCheck = new QCheckBox( cropMessage, p_ktechlab, "cropCheck" ); + TQCheckBox *cropCheck = new TQCheckBox( cropMessage, p_ktechlab, "cropCheck" ); cropCheck->setChecked(true); // yes by default? // we need an object so we can retrieve which image type was selected by the user // so setup the filedialog. - KFileDialog exportDialog(QString::null, "*.png|PNG Image\n*.bmp|BMP Image\n*.svg|SVG Image" , p_ktechlab, i18n("Export As Image"), true, cropCheck); + KFileDialog exportDialog(TQString(), "*.png|PNG Image\n*.bmp|BMP Image\n*.svg|SVG Image" , p_ktechlab, i18n("Export As Image"), true, cropCheck); exportDialog.setOperationMode( KFileDialog::Saving ); // now actually show it - if ( exportDialog.exec() == QDialog::Rejected ) + if ( exportDialog.exec() == TQDialog::Rejected ) return; KURL url = exportDialog.selectedURL(); if ( url.isEmpty() ) return; - if ( QFile::exists( url.path() ) ) + if ( TQFile::exists( url.path() ) ) { - int query = KMessageBox::warningYesNo( p_ktechlab, i18n( "A file named \"%1\" already exists. " "Are you sure you want to overwrite it?" ).arg( url.fileName() ), i18n( "Overwrite File?" ), i18n( "Overwrite" ), KStdGuiItem::cancel() ); + int query = KMessageBox::warningYesNo( p_ktechlab, i18n( "A file named \"%1\" already exists. " "Are you sure you want to overwrite it?" ).tqarg( url.fileName() ), i18n( "Overwrite File?" ), i18n( "Overwrite" ), KStdGuiItem::cancel() ); if ( query == KMessageBox::No ) return; } - // with Qt, you always "print" to a - // QPainter.. whether the output medium is a pixmap, a screen, + // with TQt, you always "print" to a + // TQPainter.. whether the output medium is a pixmap, a screen, // or paper - // needs to be something like QPicture to do SVG etc... + // needs to be something like TQPicture to do SVG etc... // at the moment the pixmap is just as big as the canvas, // intend to make some kind of cropping thing so it just // takes the bit with the circuit on. - QRect saveArea; - QString type; - QRect cropArea; - QPaintDevice *outputImage; - QString filter = exportDialog.currentFilter(); + TQRect saveArea; + TQString type; + TQRect cropArea; + TQPaintDevice *outputImage; + TQString filter = exportDialog.currentFilter(); filter = filter.lower(); // gently soften the appearance of the letters. // did have a switch here but seems you can't use that on strings @@ -877,12 +877,12 @@ void ItemDocument::exportToImage() saveArea = m_canvas->rect(); if ( type == "PNG" || type == "BMP" ) - outputImage = new QPixmap( saveArea.size() ); + outputImage = TQT_TQPAINTDEVICE(new TQPixmap( saveArea.size() )); else if ( type == "SVG" ) { setSVGExport(true); - outputImage = new QPicture(); + outputImage = TQT_TQPAINTDEVICE(new TQPicture()); // svg can't be cropped using the qimage method. saveArea = cropArea; } @@ -892,9 +892,9 @@ void ItemDocument::exportToImage() return; } - QPainter p(outputImage); + TQPainter p(outputImage); - m_canvas->setBackgroundPixmap(QPixmap()); + m_canvas->tqsetBackgroundPixmap(TQPixmap()); m_canvas->drawArea( saveArea, &p ); updateBackground(); @@ -907,11 +907,11 @@ void ItemDocument::exportToImage() if ( cropCheck->isChecked() ) { if( type == "SVG" ) - saveResult = dynamic_cast<QPicture*>(outputImage)->save( url.path(), type); + saveResult = dynamic_cast<TQPicture*>(outputImage)->save( url.path(), type); else { - QImage img = dynamic_cast<QPixmap*>(outputImage)->convertToImage(); + TQImage img = dynamic_cast<TQPixmap*>(outputImage)->convertToImage(); img = img.copy(cropArea); saveResult = img.save(url.path(),type); } @@ -919,12 +919,12 @@ void ItemDocument::exportToImage() else { if ( type=="SVG" ) - saveResult = dynamic_cast<QPicture*>(outputImage)->save( url.path(), type ); + saveResult = dynamic_cast<TQPicture*>(outputImage)->save( url.path(), type ); else - saveResult = dynamic_cast<QPixmap*>(outputImage)->save( url.path(), type ); + saveResult = dynamic_cast<TQPixmap*>(outputImage)->save( url.path(), type ); } - //if(saveResult == true) KMessageBox::information( this, i18n("Sucessfully exported to \"%1\"").arg( url.filename() ), i18n("Image Export") ); + //if(saveResult == true) KMessageBox::information( this, i18n("Sucessfully exported to \"%1\"").tqarg( url.filename() ), i18n("Image Export") ); //else KMessageBox::information( this, i18n("Export failed"), i18n("Image Export") ); if ( type == "SVG" ) @@ -940,9 +940,9 @@ void ItemDocument::exportToImage() void ItemDocument::setSVGExport( bool svgExport ) { // Find any items and tell them not to draw buttons or sliders - QCanvasItemList items = m_canvas->allItems(); - const QCanvasItemList::iterator end = items.end(); - for ( QCanvasItemList::Iterator it = items.begin(); it != end; ++it ) + TQCanvasItemList items = m_canvas->allItems(); + const TQCanvasItemList::iterator end = items.end(); + for ( TQCanvasItemList::Iterator it = items.begin(); it != end; ++it ) { if ( CNItem * cnItem = dynamic_cast<CNItem*>(*it) ) cnItem->setDrawWidgets(!svgExport); @@ -969,7 +969,7 @@ void ItemDocument::raiseZ( const ItemList & itemList ) Item * previousData = (previous == m_zOrder.end()) ? 0l : previous.data(); Item * currentData = it.data(); - if ( currentData && previousData && itemList.contains(currentData) && !itemList.contains(previousData) ) + if ( currentData && previousData && itemList.tqcontains(currentData) && !itemList.tqcontains(previousData) ) { previous.data() = currentData; it.data() = previousData; @@ -1003,7 +1003,7 @@ void ItemDocument::lowerZ( const ItemList & itemList ) Item * previousData = previous.data(); Item * currentData = it.data(); - if ( currentData && previousData && itemList.contains(currentData) && !itemList.contains(previousData) ) + if ( currentData && previousData && itemList.tqcontains(currentData) && !itemList.tqcontains(previousData) ) { previous.data() = currentData; it.data() = previousData; @@ -1039,7 +1039,7 @@ void ItemDocument::slotUpdateZOrdering() toAdd.remove(item); - if ( !item->parentItem() && item->isMovable() ) + if ( !item->tqparentItem() && item->isMovable() ) newZOrder[atLevel++] = item; } @@ -1047,7 +1047,7 @@ void ItemDocument::slotUpdateZOrdering() for ( ItemList::iterator it = toAdd.begin(); it != addEnd; ++it ) { Item * item = *it; - if ( item->parentItem() || !item->isMovable() ) + if ( item->tqparentItem() || !item->isMovable() ) continue; newZOrder[atLevel++] = item; @@ -1075,12 +1075,12 @@ void ItemDocument::update( ) //BEGIN class CanvasTip -CanvasTip::CanvasTip( ItemDocument *itemDocument, QCanvas *qcanvas ) - : QCanvasText(qcanvas) +CanvasTip::CanvasTip( ItemDocument *itemDocument, TQCanvas *qcanvas ) + : TQCanvasText(qcanvas) { p_itemDocument = itemDocument; - setColor( Qt::black ); + setColor( TQt::black ); setZ( ICNDocument::Z::Tip ); } @@ -1088,7 +1088,7 @@ CanvasTip::~CanvasTip() { } -void CanvasTip::displayVI( ECNode *node, const QPoint &pos ) +void CanvasTip::displayVI( ECNode *node, const TQPoint &pos ) { if ( !node || !updateVI() ) return; @@ -1111,7 +1111,7 @@ void CanvasTip::displayVI( ECNode *node, const QPoint &pos ) } -void CanvasTip::displayVI( Connector *connector, const QPoint &pos ) +void CanvasTip::displayVI( Connector *connector, const TQPoint &pos ) { if ( !connector || !updateVI()) return; @@ -1145,7 +1145,7 @@ bool CanvasTip::updateVI() } -void CanvasTip::display( const QPoint &pos ) +void CanvasTip::display( const TQPoint &pos ) { unsigned num = m_v.size(); @@ -1168,37 +1168,37 @@ void CanvasTip::display( const QPoint &pos ) else { - QString text; + TQString text; for ( unsigned i = 0; i < num; i++ ) - text += QString(" %1: %2\n").arg( QString::number(i) ).arg( displayText(i) ); + text += TQString(" %1: %2\n").tqarg( TQString::number(i) ).tqarg( displayText(i) ); setText(text); } } -QString CanvasTip::displayText( unsigned num ) const +TQString CanvasTip::displayText( unsigned num ) const { if ( m_v.size() <= num ) - return QString::null; + return TQString(); - return QString(" %1%2V %3%4A ") - .arg( QString::number( m_v[num] / CNItem::getMultiplier(m_v[num]), 'g', 3 ) ) - .arg( CNItem::getNumberMag( m_v[num] ) ) - .arg( QString::number( m_i[num] / CNItem::getMultiplier(m_i[num]), 'g', 3 ) ) - .arg( CNItem::getNumberMag( m_i[num] ) ); + return TQString(" %1%2V %3%4A ") + .tqarg( TQString::number( m_v[num] / CNItem::getMultiplier(m_v[num]), 'g', 3 ) ) + .tqarg( CNItem::getNumberMag( m_v[num] ) ) + .tqarg( TQString::number( m_i[num] / CNItem::getMultiplier(m_i[num]), 'g', 3 ) ) + .tqarg( CNItem::getNumberMag( m_i[num] ) ); } -void CanvasTip::draw( QPainter &p ) +void CanvasTip::draw( TQPainter &p ) { CircuitDocument *circuitDocument = dynamic_cast<CircuitDocument*>(p_itemDocument); if ( !circuitDocument || !Simulator::self()->isSimulating() ) return; - p.setBrush( QColor( 0xff, 0xff, 0xdc ) ); - p.setPen( Qt::black ); + p.setBrush( TQColor( 0xff, 0xff, 0xdc ) ); + p.setPen( TQt::black ); p.drawRect( boundingRect() ); - QCanvasText::draw(p); + TQCanvasText::draw(p); } //END class CanvasTip @@ -1207,15 +1207,15 @@ void CanvasTip::draw( QPainter &p ) //BEGIN class Canvas Canvas::Canvas( ItemDocument *itemDocument, const char * name ) - : QCanvas( itemDocument, name ) + : TQCanvas( itemDocument, name ) { p_itemDocument = itemDocument; - m_pMessageTimeout = new QTimer(this); - connect( m_pMessageTimeout, SIGNAL(timeout()), this, SLOT(slotSetAllChanged()) ); + m_pMessageTimeout = new TQTimer(this); + connect( m_pMessageTimeout, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotSetAllChanged()) ); } -void Canvas::setMessage( const QString & message ) +void Canvas::setMessage( const TQString & message ) { m_message = message; @@ -1229,9 +1229,9 @@ void Canvas::setMessage( const QString & message ) } -void Canvas::drawBackground ( QPainter &p, const QRect & clip ) +void Canvas::drawBackground ( TQPainter &p, const TQRect & clip ) { - QCanvas::drawBackground( p, clip ); + TQCanvas::drawBackground( p, clip ); #if 0 const int scx = (int)((clip.left()-4)/8); const int ecx = (int)((clip.right()+4)/8); @@ -1248,8 +1248,8 @@ void Canvas::drawBackground ( QPainter &p, const QRect & clip ) int value = (int)std::log(score)*20; if ( value>255 ) value=255; else if (value<0 ) value=0; - p.setBrush( QColor( 255, (255-value), (255-value) ) ); - p.setPen( Qt::NoPen ); + p.setBrush( TQColor( 255, (255-value), (255-value) ) ); + p.setPen( TQt::NoPen ); p.drawRect( (x*8), (y*8), 8, 8 ); } } @@ -1257,9 +1257,9 @@ void Canvas::drawBackground ( QPainter &p, const QRect & clip ) } -void Canvas::drawForeground ( QPainter &p, const QRect & clip ) +void Canvas::drawForeground ( TQPainter &p, const TQRect & clip ) { - QCanvas::drawForeground( p, clip ); + TQCanvas::drawForeground( p, clip ); if ( !m_pMessageTimeout->isActive() ) return; @@ -1269,7 +1269,7 @@ void Canvas::drawForeground ( QPainter &p, const QRect & clip ) // Following code stolen and adapted from amarok/src/playlist.cpp :) // Find out width of smallest view - QSize minSize; + TQSize minSize; const ViewList viewList = p_itemDocument->viewList(); ViewList::const_iterator end = viewList.end(); View * firstView = 0l; @@ -1290,7 +1290,7 @@ void Canvas::drawForeground ( QPainter &p, const QRect & clip ) if ( !firstView ) return; - QSimpleRichText * t = new QSimpleRichText( m_message, QApplication::font() ); + TQSimpleRichText * t = new TQSimpleRichText( m_message, TQApplication::font() ); int w = t->width(); int h = t->height(); @@ -1304,9 +1304,9 @@ void Canvas::drawForeground ( QPainter &p, const QRect & clip ) return; } - p.setBrush( firstView->colorGroup().background() ); + p.setBrush( firstView->tqcolorGroup().background() ); p.drawRoundRect( x, y, w+2*b, h+2*b, (8*200)/(w+2*b), (8*200)/(h+2*b) ); - t->draw( &p, x+b, y+b, QRect(), firstView->colorGroup() ); + t->draw( &p, x+b, y+b, TQRect(), firstView->tqcolorGroup() ); delete t; } @@ -1314,7 +1314,7 @@ void Canvas::drawForeground ( QPainter &p, const QRect & clip ) void Canvas::update() { p_itemDocument->update(); - QCanvas::update(); + TQCanvas::update(); } //END class Canvas |