summaryrefslogtreecommitdiffstats
path: root/kimagemapeditor/imagemap.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
commitdc6b8e72fed2586239e3514819238c520636c9d9 (patch)
tree88b200df0a0b7fab9d6f147596173556f1ed9a13 /kimagemapeditor/imagemap.cpp
parent6927d4436e54551917f600b706a8d6109e49de1c (diff)
downloadtdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz
tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kimagemapeditor/imagemap.cpp')
-rw-r--r--kimagemapeditor/imagemap.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/kimagemapeditor/imagemap.cpp b/kimagemapeditor/imagemap.cpp
index 665ef000..4489508d 100644
--- a/kimagemapeditor/imagemap.cpp
+++ b/kimagemapeditor/imagemap.cpp
@@ -17,9 +17,9 @@
#include "imagemap.h"
#include "kimagemapeditor.h"
-#include "qpainter.h"
+#include "tqpainter.h"
#include "kdebug.h"
-#include <qbitmap.h>
+#include <tqbitmap.h>
int round(double d) {
if ( (d-((int) d)) < 0.5 )
@@ -28,11 +28,11 @@ int round(double d) {
return ((int) d)+1;
}
-ImageMap::ImageMap(QWidget *parent,KImageMapEditor* _imageMapEditor)
- : QScrollView(parent)
+ImageMap::ImageMap(TQWidget *parent,KImageMapEditor* _imageMapEditor)
+ : TQScrollView(parent)
{
imageMapEditor=_imageMapEditor;
-// setPicture(QImage());
+// setPicture(TQImage());
currentAction=None;
currentArea=0L;
eraseOldArea=false;
@@ -46,7 +46,7 @@ ImageMap::ImageMap(QWidget *parent,KImageMapEditor* _imageMapEditor)
ImageMap::~ImageMap(){
}
-void ImageMap::setPicture(const QImage &_image) {
+void ImageMap::setPicture(const TQImage &_image) {
image=_image;
zoomedImage.convertFromImage(image);
setZoom(_zoom);
@@ -56,22 +56,22 @@ void ImageMap::setZoom(double z) {
_zoom=z;
imageRect.setHeight(image.height()*_zoom);
imageRect.setWidth(image.width()*_zoom);
- zoomedImage=QPixmap(imageRect.width(),imageRect.height());
- QPainter p(&zoomedImage);
+ zoomedImage=TQPixmap(imageRect.width(),imageRect.height());
+ TQPainter p(&zoomedImage);
p.scale(z,z);
- QPixmap pix;
+ TQPixmap pix;
pix.convertFromImage(image);
// if the picture has transparent areas,
// fill them with Gimp like background
if (pix.mask()) {
- QPixmap backPix(32,32);
- QPainter p2(&backPix);
- p2.fillRect(0,0,32,32,QColor(156,149,156));
- p2.fillRect(0,16,16,16,QColor(98,105,98));
- p2.fillRect(16,0,16,16,QColor(98,105,98));
+ TQPixmap backPix(32,32);
+ TQPainter p2(&backPix);
+ p2.fillRect(0,0,32,32,TQColor(156,149,156));
+ p2.fillRect(0,16,16,16,TQColor(98,105,98));
+ p2.fillRect(16,0,16,16,TQColor(98,105,98));
p2.flush();
- p.setPen(QPen());
- p.fillRect(imageRect.left(),imageRect.top(),imageRect.width(),imageRect.height(),QBrush(QColor("black"),backPix));
+ p.setPen(TQPen());
+ p.fillRect(imageRect.left(),imageRect.top(),imageRect.width(),imageRect.height(),TQBrush(TQColor("black"),backPix));
}
p.drawPixmap(imageRect.left(),imageRect.top(),pix);
p.flush();
@@ -80,21 +80,21 @@ void ImageMap::setZoom(double z) {
repaintContents(0,0,contentsWidth(),contentsHeight(),true);
}
-QPoint ImageMap::translateFromZoom(const QPoint & p) const {
- return QPoint(p.x()/_zoom,p.y()/_zoom);
+TQPoint ImageMap::translateFromZoom(const TQPoint & p) const {
+ return TQPoint(p.x()/_zoom,p.y()/_zoom);
}
-QPoint ImageMap::translateToZoom(const QPoint & p) const {
- return QPoint(round(p.x()*_zoom),round(p.y()*_zoom));
+TQPoint ImageMap::translateToZoom(const TQPoint & p) const {
+ return TQPoint(round(p.x()*_zoom),round(p.y()*_zoom));
}
-QRect ImageMap::translateToZoom(const QRect & r) const {
- return QRect(round(r.x()*_zoom),round(r.y()*_zoom),
+TQRect ImageMap::translateToZoom(const TQRect & r) const {
+ return TQRect(round(r.x()*_zoom),round(r.y()*_zoom),
round(r.width()*_zoom),round(r.height()*_zoom));
}
-void ImageMap::contentsMouseDoubleClickEvent(QMouseEvent* e) {
- QPoint point=e->pos();
+void ImageMap::contentsMouseDoubleClickEvent(TQMouseEvent* e) {
+ TQPoint point=e->pos();
point-=imageRect.topLeft();
point=translateFromZoom(point);
if ( currentAction==None &&
@@ -103,7 +103,7 @@ void ImageMap::contentsMouseDoubleClickEvent(QMouseEvent* e) {
}
-void ImageMap::contentsMousePressEvent(QMouseEvent* e) {
+void ImageMap::contentsMousePressEvent(TQMouseEvent* e) {
drawStart=e->pos();
// Check if it's on picture if not
// move it to the picture's border
@@ -141,7 +141,7 @@ void ImageMap::contentsMousePressEvent(QMouseEvent* e) {
} else
if (imageMapEditor->currentShapeType()!=Area::None) {
currentArea=new Area(imageMapEditor->currentShapeType());
- currentArea->setRect(QRect(drawStart,drawStart));
+ currentArea->setRect(TQRect(drawStart,drawStart));
currentArea->setSelected(false);
if (imageMapEditor->selected())
imageMapEditor->selected()->setSelected(false);
@@ -167,7 +167,7 @@ void ImageMap::contentsMousePressEvent(QMouseEvent* e) {
}
- QRect r;
+ TQRect r;
if (oldArea)
r=oldArea->selectionRect();
if (currentArea) {
@@ -177,7 +177,7 @@ void ImageMap::contentsMousePressEvent(QMouseEvent* e) {
}
-void ImageMap::contentsMouseReleaseEvent(QMouseEvent *e) {
+void ImageMap::contentsMouseReleaseEvent(TQMouseEvent *e) {
drawEnd=e->pos();
// Check if it's on picture if not
@@ -238,7 +238,7 @@ void ImageMap::contentsMouseReleaseEvent(QMouseEvent *e) {
}
-void ImageMap::contentsMouseMoveEvent(QMouseEvent *e) {
+void ImageMap::contentsMouseMoveEvent(TQMouseEvent *e) {
drawCurrent=e->pos();
// If outside the image
@@ -260,51 +260,51 @@ void ImageMap::contentsMouseMoveEvent(QMouseEvent *e) {
if (currentAction==DrawRectangle) {
// To avoid flicker, only repaint the minimum rect
- QRect oldRect=translateToZoom(currentArea->rect());
- currentArea->setRect(QRect(drawStart,drawCurrent).normalize());
- QRect newRect=translateToZoom(currentArea->rect());
- QRect r=oldRect | newRect;
+ TQRect oldRect=translateToZoom(currentArea->rect());
+ currentArea->setRect(TQRect(drawStart,drawCurrent).normalize());
+ TQRect newRect=translateToZoom(currentArea->rect());
+ TQRect r=oldRect | newRect;
repaintContents(r,false);
imageMapEditor->slotUpdateSelectionCoords(currentArea->rect());
} else
if (currentAction==DrawCircle) {
- QRect oldRect=translateToZoom(currentArea->rect());
- currentArea->setRect(QRect(drawStart,drawCurrent).normalize());
- QRect newRect=translateToZoom(currentArea->rect());
- QRect r=oldRect | newRect;
+ TQRect oldRect=translateToZoom(currentArea->rect());
+ currentArea->setRect(TQRect(drawStart,drawCurrent).normalize());
+ TQRect newRect=translateToZoom(currentArea->rect());
+ TQRect r=oldRect | newRect;
repaintContents(r,false);
imageMapEditor->slotUpdateSelectionCoords(currentArea->rect());
} else
if ( currentAction==DrawPolygon ) {
- QRect oldRect=translateToZoom(currentArea->rect());
+ TQRect oldRect=translateToZoom(currentArea->rect());
currentArea->moveSelectionPoint(currentSelectionPoint,drawCurrent);
- QRect newRect=translateToZoom(currentArea->rect());
- QRect r=oldRect | newRect;
+ TQRect newRect=translateToZoom(currentArea->rect());
+ TQRect r=oldRect | newRect;
repaintContents(r,false);
imageMapEditor->slotUpdateSelectionCoords(currentArea->rect());
} else
if ( currentAction==MoveArea ) {
- QRect oldRect=translateToZoom(currentArea->selectionRect());
+ TQRect oldRect=translateToZoom(currentArea->selectionRect());
currentArea->moveBy((drawCurrent-drawStart).x(),(drawCurrent-drawStart).y());
- QRect newRect=translateToZoom(currentArea->selectionRect());
- QRect r=oldRect | newRect;
+ TQRect newRect=translateToZoom(currentArea->selectionRect());
+ TQRect r=oldRect | newRect;
repaintContents(r,false);
drawStart=drawCurrent;
imageMapEditor->slotUpdateSelectionCoords();
} else
if ( currentAction==MoveSelectionPoint ) {
- QRect oldRect=translateToZoom(currentArea->selectionRect());
+ TQRect oldRect=translateToZoom(currentArea->selectionRect());
currentArea->moveSelectionPoint(currentSelectionPoint,drawCurrent);
- QRect newRect=translateToZoom(currentArea->selectionRect());
- QRect r=oldRect | newRect;
+ TQRect newRect=translateToZoom(currentArea->selectionRect());
+ TQRect r=oldRect | newRect;
repaintContents(r,false);
imageMapEditor->slotUpdateSelectionCoords();
}
imageMapEditor->slotChangeStatusCoords(drawCurrent.x(),drawCurrent.y());
}
-void ImageMap::resizeEvent(QResizeEvent* e) {
- QScrollView::resizeEvent(e);
+void ImageMap::resizeEvent(TQResizeEvent* e) {
+ TQScrollView::resizeEvent(e);
int width=(int) (image.width()*_zoom);
int height=(int) (image.height()*_zoom);
if (visibleWidth()>width)
@@ -325,7 +325,7 @@ void ImageMap::repaintArea(const Area & a) {
repaintContents(translateToZoom(a.selectionRect()),false);
}
-void ImageMap::drawContents(QPainter* p,int clipx,int clipy,int clipw,int cliph) {
+void ImageMap::drawContents(TQPainter* p,int clipx,int clipy,int clipw,int cliph) {
// kdDebug() << "drawing\n" << endl;
// p.scale(rect.width()*2,rect.height()*2);
// if (e->rect()!=rect()) {
@@ -334,16 +334,16 @@ void ImageMap::drawContents(QPainter* p,int clipx,int clipy,int clipw,int cliph)
// } else
/* if (currentAction==DrawRectangle) {
p->setClipping(true);
- QRect r(currentArea->rect());
+ TQRect r(currentArea->rect());
r.moveBy(imageRect.left()-5,imageRect.top()-5);
- r.setSize(r.size()+QSize(10,10));
+ r.setSize(r.size()+TQSize(10,10));
p->setClipRegion(r);
}
*/
- QRect updateRect(clipx,clipy,clipw,cliph);
- QPixmap doubleBuffer(updateRect.size()); // Pixmap for double-buffering
- QPainter p2(&doubleBuffer);
+ TQRect updateRect(clipx,clipy,clipw,cliph);
+ TQPixmap doubleBuffer(updateRect.size()); // Pixmap for double-buffering
+ TQPainter p2(&doubleBuffer);
p2.drawPixmap(0,0,zoomedImage,clipx,clipy,clipw,cliph);
p2.translate(-updateRect.x(), -updateRect.y());
p2.scale(_zoom,_zoom);
@@ -365,8 +365,8 @@ void ImageMap::drawContents(QPainter* p,int clipx,int clipy,int clipw,int cliph)
// Copy the double buffer into the widget
p->drawPixmap(clipx,clipy,doubleBuffer);
// Erase background without flicker
- QRegion region(contentsX(),contentsY(),visibleWidth(),visibleHeight());
- region=region.subtract(QRegion(imageRect));
+ TQRegion region(contentsX(),contentsY(),visibleWidth(),visibleHeight());
+ region=region.subtract(TQRegion(imageRect));
for (int i=0;i<region.rects().count();i++) {
p->eraseRect(region.rects()[i]);
}