summaryrefslogtreecommitdiffstats
path: root/kplato/kptpertcanvas.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kplato/kptpertcanvas.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kplato/kptpertcanvas.cc')
-rw-r--r--kplato/kptpertcanvas.cc132
1 files changed, 66 insertions, 66 deletions
diff --git a/kplato/kptpertcanvas.cc b/kplato/kptpertcanvas.cc
index a50672bc..910ec600 100644
--- a/kplato/kptpertcanvas.cc
+++ b/kplato/kptpertcanvas.cc
@@ -23,17 +23,17 @@
#include "kptrelationdialog.h"
#include "kptcanvasitem.h"
-#include <qbuffer.h>
-#include <qtimer.h>
-#include <qclipboard.h>
-#include <qprogressdialog.h>
-#include <qobjectlist.h>
-#include <qpainter.h>
-#include <qheader.h>
-#include <qcursor.h>
-#include <qrect.h>
-#include <qsize.h>
-#include <qptrlist.h>
+#include <tqbuffer.h>
+#include <tqtimer.h>
+#include <tqclipboard.h>
+#include <tqprogressdialog.h>
+#include <tqobjectlist.h>
+#include <tqpainter.h>
+#include <tqheader.h>
+#include <tqcursor.h>
+#include <tqrect.h>
+#include <tqsize.h>
+#include <tqptrlist.h>
#include <KoStore.h>
#include <ktempfile.h>
@@ -48,15 +48,15 @@
namespace KPlato
{
-PertCanvas::PertCanvas( QWidget *parent )
- : QCanvasView( parent, "Pert canvas" /*WNorthWestGravity WStaticContents| WResizeNoErase | WRepaintNoErase */),
+PertCanvas::PertCanvas( TQWidget *tqparent )
+ : TQCanvasView( tqparent, "Pert canvas" /*WNorthWestGravity WStaticContents| WResizeNoErase | WRepaintNoErase */),
m_verticalGap(20),
m_horizontalGap(10),
m_itemSize(100,30)
{
- //setHScrollBarMode(QScrollView::AlwaysOn);
- m_canvas = new QCanvas( this );
+ //setHScrollBarMode(TQScrollView::AlwaysOn);
+ m_canvas = new TQCanvas( TQT_TQOBJECT(this) );
setCanvas( m_canvas );
}
@@ -71,19 +71,19 @@ void PertCanvas::draw(Project& project)
updateContents();
// First make node items
- QPtrListIterator<Node> nit(project.childNodeIterator());
+ TQPtrListIterator<Node> nit(project.childNodeIterator());
for ( ; nit.current(); ++nit ) {
createChildItems(createNodeItem(nit.current()));
}
// First all items with relations
- QPtrDictIterator<PertNodeItem> it(m_nodes);
+ TQPtrDictIterator<PertNodeItem> it(m_nodes);
for(; it.current(); ++it)
{
if (!(it.current()->hasParent()) && it.current()->hasChild())
{
- m_rows.append(new QMemArray<bool>(1)); // New node always goes into new row, first column
- it.current()->move(this, m_rows.count()-1, 0); // item also moves it's children
+ m_rows.append(new TQMemArray<bool>(1)); // New node always goes into new row, first column
+ it.current()->move(this, m_rows.count()-1, 0); // item also moves it's tqchildren
}
}
// now items without relations
@@ -91,19 +91,19 @@ void PertCanvas::draw(Project& project)
{
if (!(it.current()->hasParent() || it.current()->hasChild()))
{
- m_rows.append(new QMemArray<bool>(1)); // New node always goes into new row, first column
+ m_rows.append(new TQMemArray<bool>(1)); // New node always goes into new row, first column
it.current()->move(this, m_rows.count()-1, 0);
}
}
drawRelations(); // done _after_ all nodes are drawn
- QSize s = canvasSize();
+ TQSize s = canvasSize();
m_canvas->resize(s.width(), s.height());
update();
}
PertNodeItem *PertCanvas::createNodeItem(Node *node)
{
- PertNodeItem *item = m_nodes.find(node);
+ PertNodeItem *item = m_nodes.tqfind(node);
if (!item)
{
if ( node->type() == Node::Type_Project)
@@ -125,23 +125,23 @@ PertNodeItem *PertCanvas::createNodeItem(Node *node)
return item;
}
-void PertCanvas::createChildItems(PertNodeItem *parentItem)
+void PertCanvas::createChildItems(PertNodeItem *tqparentItem)
{
- //kdDebug()<<k_funcinfo<<"parentItem="<<(parentItem ? parentItem->node().name() : "nil")<<endl;
- if (!parentItem)
+ //kdDebug()<<k_funcinfo<<"tqparentItem="<<(tqparentItem ? tqparentItem->node().name() : "nil")<<endl;
+ if (!tqparentItem)
return;
- QPtrListIterator<Relation> it(parentItem->node().dependChildNodes());
+ TQPtrListIterator<Relation> it(tqparentItem->node().dependChildNodes());
for (; it.current(); ++it)
{
PertNodeItem *childItem = createNodeItem(it.current()->child());
if (childItem)
- parentItem->addChildRelation(it.current(), childItem);
+ tqparentItem->addChildRelation(it.current(), childItem);
m_relations.append(it.current());
}
- // Now my children
- QPtrListIterator<Node> nit(parentItem->node().childNodeIterator());
+ // Now my tqchildren
+ TQPtrListIterator<Node> nit(tqparentItem->node().childNodeIterator());
for ( ; nit.current(); ++nit ) {
createChildItems(createNodeItem(nit.current()));
}
@@ -150,14 +150,14 @@ void PertCanvas::createChildItems(PertNodeItem *parentItem)
void PertCanvas::drawRelations()
{
//kdDebug()<<k_funcinfo<<endl;
- QPtrListIterator<Relation> it(m_relations);
+ TQPtrListIterator<Relation> it(m_relations);
for (; it.current(); ++it)
{
- PertNodeItem *parentItem = m_nodes.find(it.current()->parent());
- PertNodeItem *childItem = m_nodes.find(it.current()->child());
- if (parentItem && childItem)
+ PertNodeItem *tqparentItem = m_nodes.tqfind(it.current()->tqparent());
+ PertNodeItem *childItem = m_nodes.tqfind(it.current()->child());
+ if (tqparentItem && childItem)
{
- PertRelationItem *item = new PertRelationItem(this, parentItem, childItem, it.current());
+ PertRelationItem *item = new PertRelationItem(this, tqparentItem, childItem, it.current());
item->show();
}
}
@@ -174,25 +174,25 @@ void PertCanvas::mapNode(PertNodeItem *item)
m_rows.at(item->row())->at(item->column()) = true;
}
-void PertCanvas::mapChildNode(PertNodeItem *parentItem, PertNodeItem *childItem, Relation::Type type)
+void PertCanvas::mapChildNode(PertNodeItem *tqparentItem, PertNodeItem *childItem, Relation::Type type)
{
- //kdDebug()<<k_funcinfo<<"Parent: "<<parentItem->node().name()<<" to child: "<<(childItem ? childItem->node().name() : "None")<<endl;
+ //kdDebug()<<k_funcinfo<<"Parent: "<<tqparentItem->node().name()<<" to child: "<<(childItem ? childItem->node().name() : "None")<<endl;
if (!childItem)
{ // shouldn't happen...
kdError()<<k_funcinfo<<"No childItem"<<endl;
return;
}
- int row = parentItem->row();
- int col = parentItem->column();
+ int row = tqparentItem->row();
+ int col = tqparentItem->column();
int chRow = childItem->row();
int chCol = childItem->column();
bool chMapped = (chRow > -1 && chCol > -1);
- //kdDebug()<<k_funcinfo<<"Parent: "<<parentItem->node().name()<<" at ("<<row<<","<<col<<"): Moving "<<childItem->node().name()<<" from: "<<chRow<<","<<chCol<<endl;
+ //kdDebug()<<k_funcinfo<<"Parent: "<<tqparentItem->node().name()<<" at ("<<row<<","<<col<<"): Moving "<<childItem->node().name()<<" from: "<<chRow<<","<<chCol<<endl;
if (type == Relation::StartStart ||
type == Relation::FinishFinish)
{
- // node goes into row below parent, at least same col
+ // node goes into row below tqparent, at least same col
if (chMapped)
{
m_rows.at(chRow)->at(chCol) = false;
@@ -201,7 +201,7 @@ void PertCanvas::mapChildNode(PertNodeItem *parentItem, PertNodeItem *childItem,
{
chRow = row+1;
if (chRow >= 0 && m_rows.count() <= uint(chRow)) {
- m_rows.append(new QMemArray<bool>(1)); // make a new row
+ m_rows.append(new TQMemArray<bool>(1)); // make a new row
chRow = m_rows.count()-1; // to be safe
}
//kdDebug()<<k_funcinfo<<" Moving "<<childItem->node().name()<<" to row: "<<chRow<<endl;
@@ -221,7 +221,7 @@ void PertCanvas::mapChildNode(PertNodeItem *parentItem, PertNodeItem *childItem,
if (!(m_rows.at(row+1)) || // next row does not exists
m_rows.at(row+1)->at(col) == true) // col is not free
{
- m_rows.append(new QMemArray<bool>(col+1)); // make a new row
+ m_rows.append(new TQMemArray<bool>(col+1)); // make a new row
}
else if (col >= 0 && m_rows.at(row+1)->count() <= uint(col)) // col does not exist
m_rows.at(row)->resize(col+1);
@@ -251,7 +251,7 @@ void PertCanvas::mapChildNode(PertNodeItem *parentItem, PertNodeItem *childItem,
if (col >= 0 && m_rows.at(row)->count() <= uint(col))
m_rows.at(row)->resize(col+1); // make new column
else if (m_rows.at(row)->at(col) = true)
- m_rows.append(new QMemArray<bool>(col+1)); // col not free, so make a new row
+ m_rows.append(new TQMemArray<bool>(col+1)); // col not free, so make a new row
chRow = m_rows.count() -1;
chCol = col;
@@ -265,17 +265,17 @@ void PertCanvas::mapChildNode(PertNodeItem *parentItem, PertNodeItem *childItem,
childItem->move(this, chRow, chCol);
}
-QSize PertCanvas::canvasSize()
+TQSize PertCanvas::canvasSize()
{
//kdDebug()<<k_funcinfo<<endl;
- QSize s(0,0);
- QCanvasItemList list = canvas()->allItems();
- QCanvasItemList::Iterator it = list.begin();
+ TQSize s(0,0);
+ TQCanvasItemList list = canvas()->allItems();
+ TQCanvasItemList::Iterator it = list.begin();
for (; it != list.end(); ++it)
{
- QRect r = (*it)->boundingRect();
- s.setWidth(QMAX(s.width(), r.right()));
- s.setHeight(QMAX(s.height(), r.bottom()));
+ TQRect r = (*it)->boundingRect();
+ s.setWidth(TQMAX(s.width(), r.right()));
+ s.setHeight(TQMAX(s.height(), r.bottom()));
}
s.setWidth(s.width()+20);
s.setHeight(s.height()+20);
@@ -287,8 +287,8 @@ void PertCanvas::clear()
m_nodes.clear();
m_relations.clear();
m_rows.clear();
- QCanvasItemList list = canvas()->allItems();
- QCanvasItemList::Iterator it = list.begin();
+ TQCanvasItemList list = canvas()->allItems();
+ TQCanvasItemList::Iterator it = list.begin();
for (; it != list.end(); ++it)
{
if ( *it )
@@ -296,24 +296,24 @@ void PertCanvas::clear()
}
}
-void PertCanvas::contentsMousePressEvent ( QMouseEvent * e )
+void PertCanvas::contentsMousePressEvent ( TQMouseEvent * e )
{
//kdDebug()<<k_funcinfo<<" gl.X,gl.Y="<<e->globalX()<<","<<e->globalY()<<" x,y="<<e->x()<<","<<e->y()<<endl;
switch (e->button())
{
- case QEvent::LeftButton:
+ case Qt::LeftButton:
{
break;
}
- case QEvent::RightButton:
+ case Qt::RightButton:
{
PertNodeItem *item = selectedItem();
if (item)
item->setSelected(false);
canvas()->update();
- QCanvasItemList l = canvas()->collisions(e->pos());
- for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ TQCanvasItemList l = canvas()->collisions(e->pos());
+ for (TQCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
{
if ( (*it)->rtti() == PertProjectItem::RTTI ||
(*it)->rtti() == PertTaskItem::RTTI ||
@@ -335,23 +335,23 @@ void PertCanvas::contentsMousePressEvent ( QMouseEvent * e )
}
break;
}
- case QEvent::MidButton:
+ case Qt::MidButton:
break;
default:
break;
}
}
-void PertCanvas::contentsMouseReleaseEvent ( QMouseEvent * e )
+void PertCanvas::contentsMouseReleaseEvent ( TQMouseEvent * e )
{
//kdDebug()<<k_funcinfo<<" gl.X,gl.Y="<<e->globalX()<<","<<e->globalY()<<" x,y="<<e->x()<<","<<e->y()<<endl;
switch (e->button())
{
- case QEvent::LeftButton:
+ case Qt::LeftButton:
{
bool hit = false;
- QCanvasItemList l = canvas()->collisions(e->pos());
- for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ TQCanvasItemList l = canvas()->collisions(e->pos());
+ for (TQCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
{
if ( (*it)->rtti() == PertProjectItem::RTTI ||
(*it)->rtti() == PertTaskItem::RTTI ||
@@ -393,11 +393,11 @@ void PertCanvas::contentsMouseReleaseEvent ( QMouseEvent * e )
canvas()->update();
break;
}
- case QEvent::RightButton:
+ case Qt::RightButton:
{
break;
}
- case QEvent::MidButton:
+ case Qt::MidButton:
break;
default:
break;
@@ -406,8 +406,8 @@ void PertCanvas::contentsMouseReleaseEvent ( QMouseEvent * e )
PertNodeItem *PertCanvas::selectedItem()
{
- QCanvasItemList list = canvas()->allItems();
- QCanvasItemList::Iterator it = list.begin();
+ TQCanvasItemList list = canvas()->allItems();
+ TQCanvasItemList::Iterator it = list.begin();
for (; it != list.end(); ++it)
{
if ( (*it)->isSelected() )