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/drawparts/dpline.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/drawparts/dpline.cpp')
-rw-r--r-- | src/drawparts/dpline.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/drawparts/dpline.cpp b/src/drawparts/dpline.cpp index 59fa789..4d17b01 100644 --- a/src/drawparts/dpline.cpp +++ b/src/drawparts/dpline.cpp @@ -16,7 +16,7 @@ #include <cmath> #include <kiconloader.h> #include <klocale.h> -#include <qpainter.h> +#include <tqpainter.h> //BEGIN class DPLine @@ -28,7 +28,7 @@ Item* DPLine::construct( ItemDocument *itemDocument, bool newItem, const char *i LibraryItem* DPLine::libraryItem() { return new LibraryItem( - QString("dp/line"), + TQString("dp/line"), i18n("Line"), i18n("Other"), KGlobal::iconLoader()->loadIcon( "text", KIcon::Small ), @@ -45,7 +45,7 @@ DPLine::DPLine( ItemDocument *itemDocument, bool newItem, const char *id ) createProperty( "line-color", Variant::Type::Color ); property("line-color")->setCaption( i18n("Line Color") ); - property("line-color")->setValue(Qt::black); + property("line-color")->setValue(TQt::black); createProperty( "line-width", Variant::Type::Int ); property("line-width")->setCaption( i18n("Line Width") ); @@ -80,7 +80,7 @@ void DPLine::setSelected( bool yes ) void DPLine::dataChanged() { - setPen( QPen( dataColor("line-color"), + setPen( TQPen( dataColor("line-color"), unsigned( dataInt("line-width") ), getDataPenStyle("line-style"), getDataPenCapStyle("cap-style"), @@ -98,44 +98,44 @@ void DPLine::postResize() int x2 = x1+width(); int y2 = y1+height(); - QPointArray p(4); + TQPointArray p(4); int pw = pen().width(); - int dx = QABS(x1-x2); - int dy = QABS(y1-y2); + int dx = TQABS(x1-x2); + int dy = TQABS(y1-y2); pw = pw*4/3+2; // approx pw*sqrt(2) int px = x1<x2 ? -pw : pw ; int py = y1<y2 ? -pw : pw ; if ( dx && dy && (dx > dy ? (dx*2/dy <= 2) : (dy*2/dx <= 2)) ) { // steep if ( px == py ) { - p[0] = QPoint(x1 ,y1+py); - p[1] = QPoint(x2-px,y2 ); - p[2] = QPoint(x2 ,y2-py); - p[3] = QPoint(x1+px,y1 ); + p[0] = TQPoint(x1 ,y1+py); + p[1] = TQPoint(x2-px,y2 ); + p[2] = TQPoint(x2 ,y2-py); + p[3] = TQPoint(x1+px,y1 ); } else { - p[0] = QPoint(x1+px,y1 ); - p[1] = QPoint(x2 ,y2-py); - p[2] = QPoint(x2-px,y2 ); - p[3] = QPoint(x1 ,y1+py); + p[0] = TQPoint(x1+px,y1 ); + p[1] = TQPoint(x2 ,y2-py); + p[2] = TQPoint(x2-px,y2 ); + p[3] = TQPoint(x1 ,y1+py); } } else if ( dx > dy ) { // horizontal - p[0] = QPoint(x1+px,y1+py); - p[1] = QPoint(x2-px,y2+py); - p[2] = QPoint(x2-px,y2-py); - p[3] = QPoint(x1+px,y1-py); + p[0] = TQPoint(x1+px,y1+py); + p[1] = TQPoint(x2-px,y2+py); + p[2] = TQPoint(x2-px,y2-py); + p[3] = TQPoint(x1+px,y1-py); } else { // vertical - p[0] = QPoint(x1+px,y1+py); - p[1] = QPoint(x2+px,y2-py); - p[2] = QPoint(x2-px,y2-py); - p[3] = QPoint(x1-px,y1+py); + p[0] = TQPoint(x1+px,y1+py); + p[1] = TQPoint(x2+px,y2-py); + p[2] = TQPoint(x2-px,y2-py); + p[3] = TQPoint(x1-px,y1+py); } setItemPoints( p, false ); } -void DPLine::drawShape( QPainter & p ) +void DPLine::drawShape( TQPainter & p ) { int x1 = int(x()+offsetX()); int y1 = int(y()+offsetY()); @@ -156,7 +156,7 @@ Item* DPArrow::construct( ItemDocument *itemDocument, bool newItem, const char * LibraryItem* DPArrow::libraryItem() { return new LibraryItem( - QString("dp/arrow"), + TQString("dp/arrow"), i18n("Arrow"), i18n("Other"), KGlobal::iconLoader()->loadIcon( "text", KIcon::Small ), @@ -170,7 +170,7 @@ DPArrow::DPArrow( ItemDocument *itemDocument, bool newItem, const char *id ) m_name = i18n("Arrow"); // We don't want to use the square cap style as it screws up drawing our arrow head - QStringList allowed = property("cap-style")->allowed(); + TQStringList allowed = property("cap-style")->allowed(); allowed.remove( DrawPart::penCapStyleToName( Qt::SquareCap ) ); property("cap-style")->setAllowed(allowed); } @@ -180,7 +180,7 @@ DPArrow::~DPArrow() } -void DPArrow::drawShape( QPainter & p ) +void DPArrow::drawShape( TQPainter & p ) { int x1 = int(x()+offsetX()); int y1 = int(y()+offsetY()); @@ -210,14 +210,14 @@ void DPArrow::drawShape( QPainter & p ) int y4 = int( y2 + head_length*std::sin( pi + arrow_angle + head_angle ) ); // Draw arrowhead - QPen pen = p.pen(); + TQPen pen = p.pen(); pen.setCapStyle( Qt::RoundCap ); p.setPen(pen); p.setBrush(pen.color()); - QPointArray pa(3); - pa[0] = QPoint( x2, y2 ); - pa[1] = QPoint( x3, y3 ); - pa[2] = QPoint( x4, y4 ); + TQPointArray pa(3); + pa[0] = TQPoint( x2, y2 ); + pa[1] = TQPoint( x3, y3 ); + pa[2] = TQPoint( x4, y4 ); p.drawPolygon(pa); p.drawPolyline(pa); // p.drawLine( x2, y2, x3, y3 ); |