summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/printwizard/cropframe.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-18 06:46:40 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-18 06:46:40 +0000
commit7c19562ad065b6729bac8eb9b40dfe0452a72272 (patch)
tree33325d1e02ecc9ca614c7209296f8f796a1c3478 /kipi-plugins/printwizard/cropframe.cpp
parenta65baa328fac0a1ce12971fef8d998ce7bfbe237 (diff)
downloadkipi-plugins-7c19562ad065b6729bac8eb9b40dfe0452a72272.tar.gz
kipi-plugins-7c19562ad065b6729bac8eb9b40dfe0452a72272.zip
TQt4 port kipi-plugins
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/libraries/kipi-plugins@1232561 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kipi-plugins/printwizard/cropframe.cpp')
-rw-r--r--kipi-plugins/printwizard/cropframe.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/kipi-plugins/printwizard/cropframe.cpp b/kipi-plugins/printwizard/cropframe.cpp
index 60eb532..1f86ae5 100644
--- a/kipi-plugins/printwizard/cropframe.cpp
+++ b/kipi-plugins/printwizard/cropframe.cpp
@@ -23,10 +23,10 @@ extern "C"
#include <stdio.h>
}
-// Qt includes.
+// TQt includes.
-#include <qpainter.h>
-#include <qimage.h>
+#include <tqpainter.h>
+#include <tqimage.h>
// Local includes.
@@ -36,8 +36,8 @@ extern "C"
namespace KIPIPrintWizardPlugin
{
-CropFrame::CropFrame(QWidget *parent=0, const char *name=0)
- : QWidget(parent, name)
+CropFrame::CropFrame(TQWidget *tqparent=0, const char *name=0)
+ : TQWidget(tqparent, name)
{
m_mouseDown = false;
}
@@ -49,10 +49,10 @@ CropFrame::CropFrame(QWidget *parent=0, const char *name=0)
void CropFrame::init(TPhoto *photo, int width, int height, bool autoRotate, bool paint)
{
m_photo = photo;
- QImage scaledImg = m_photo->thumbnail().convertToImage();
+ TQImage scaledImg = m_photo->thumbnail().convertToImage();
// has the cropRegion been set yet?
- bool resetCropRegion = (m_photo->cropRegion == QRect(-1, -1, -1, -1));
+ bool resetCropRegion = (m_photo->cropRegion == TQRect(-1, -1, -1, -1));
if (resetCropRegion)
{
// first, let's see if we should rotate
@@ -70,22 +70,22 @@ void CropFrame::init(TPhoto *photo, int width, int height, bool autoRotate, bool
else
{
// does the crop region need updating (but the image shouldn't be rotated)?
- resetCropRegion = (m_photo->cropRegion == QRect(-2, -2, -2, -2));
+ resetCropRegion = (m_photo->cropRegion == TQRect(-2, -2, -2, -2));
}
// rotate
- QWMatrix matrix;
+ TQWMatrix matrix;
matrix.rotate(m_photo->rotation);
scaledImg = scaledImg.xForm(matrix);
- scaledImg = scaledImg.smoothScale(this->width(), this->height(), QImage::ScaleMin);
+ scaledImg = scaledImg.smoothScale(this->width(), this->height(), TQ_ScaleMin);
- m_pixmap = new QPixmap();
+ m_pixmap = new TQPixmap();
m_pixmap->convertFromImage(scaledImg);
m_pixmapX = (this->width() / 2) - (m_pixmap->width() / 2);
m_pixmapY = (this->height() / 2) - (m_pixmap->height() / 2);
- m_color = Qt::red;
+ m_color = TQt::red;
// size the rectangle based on the minimum image dimension
int w = m_pixmap->width();
int h = m_pixmap->height();;
@@ -118,10 +118,10 @@ void CropFrame::init(TPhoto *photo, int width, int height, bool autoRotate, bool
m_cropRegion = _photoToScreenRect(m_photo->cropRegion);
if (paint)
- repaint(false);
+ tqrepaint(false);
}
-QRect CropFrame::_screenToPhotoRect(QRect r)
+TQRect CropFrame::_screenToPhotoRect(TQRect r)
{
// r is given in screen coordinates, and we want to convert that
// to photo coordinates
@@ -155,12 +155,12 @@ QRect CropFrame::_screenToPhotoRect(QRect r)
int w = NINT(r.width() * xRatio);
int h = NINT(r.height() * yRatio);
- QRect result;
+ TQRect result;
result.setRect(x1, y1, w, h);
return result;
}
-QRect CropFrame::_photoToScreenRect(QRect r)
+TQRect CropFrame::_photoToScreenRect(TQRect r)
{
// r is given in photo coordinates, and we want to convert that
// to screen coordinates
@@ -195,7 +195,7 @@ QRect CropFrame::_photoToScreenRect(QRect r)
int w = NINT(r.width() * xRatio);
int h = NINT(r.height() * yRatio);
- QRect result;
+ TQRect result;
result.setRect(x1, y1, w, h);
return result;
}
@@ -203,11 +203,11 @@ QRect CropFrame::_photoToScreenRect(QRect r)
CropFrame::~CropFrame()
{
}
-void CropFrame::paintEvent (QPaintEvent *)
+void CropFrame::paintEvent (TQPaintEvent *)
{
- QPixmap bmp(this->width(), this->height());
- QPainter p;
+ TQPixmap bmp(this->width(), this->height());
+ TQPainter p;
p.begin(&bmp);
p.eraseRect(0, 0, this->width(), this->height());
@@ -216,7 +216,7 @@ void CropFrame::paintEvent (QPaintEvent *)
p.drawPixmap(m_pixmapX, m_pixmapY, *m_pixmap);
// draw the rectangle
- p.setPen(QPen(m_color, 2));
+ p.setPen(TQPen(m_color, 2));
p.drawRect(m_cropRegion);
// draw the crosshairs
int midX = m_cropRegion.left() + m_cropRegion.width() / 2;
@@ -225,13 +225,13 @@ void CropFrame::paintEvent (QPaintEvent *)
p.drawLine(midX, midY - 10, midX, midY + 10);
p.end();
- QPainter newp(this);
+ TQPainter newp(this);
newp.drawPixmap(0, 0, bmp);
}
-void CropFrame::mousePressEvent(QMouseEvent *e)
+void CropFrame::mousePressEvent(TQMouseEvent *e)
{
- if (e->button() == QMouseEvent::LeftButton)
+ if (e->button() == Qt::LeftButton)
{
m_mouseDown = true;
this->mouseMoveEvent(e);
@@ -239,13 +239,13 @@ void CropFrame::mousePressEvent(QMouseEvent *e)
}
-void CropFrame::mouseReleaseEvent(QMouseEvent *e)
+void CropFrame::mouseReleaseEvent(TQMouseEvent *e)
{
- if (e->button() == QMouseEvent::LeftButton)
+ if (e->button() == Qt::LeftButton)
m_mouseDown = false;
}
-void CropFrame::mouseMoveEvent(QMouseEvent *e)
+void CropFrame::mouseMoveEvent(TQMouseEvent *e)
{
if (m_mouseDown)
{
@@ -263,23 +263,23 @@ void CropFrame::mouseMoveEvent(QMouseEvent *e)
m_cropRegion.setRect(newX, newY, newW, newH);
m_photo->cropRegion = _screenToPhotoRect(m_cropRegion);
- repaint(false);
+ tqrepaint(false);
}
}
-void CropFrame::keyPressEvent(QKeyEvent *e)
+void CropFrame::keyPressEvent(TQKeyEvent *e)
{
int newX = m_cropRegion.x();
int newY = m_cropRegion.y();
switch (e->key()) {
- case Qt::Key_Up : newY--;
+ case TQt::Key_Up : newY--;
break;
- case Qt::Key_Down : newY++;
+ case TQt::Key_Down : newY++;
break;
- case Qt::Key_Left : newX--;
+ case TQt::Key_Left : newX--;
break;
- case Qt::Key_Right : newX++;
+ case TQt::Key_Right : newX++;
break;
}
@@ -295,17 +295,17 @@ void CropFrame::keyPressEvent(QKeyEvent *e)
m_cropRegion.setRect(newX, newY, w, h);
m_photo->cropRegion = _screenToPhotoRect(m_cropRegion);
- repaint(false);
+ tqrepaint(false);
}
-void CropFrame::setColor(QColor c)
+void CropFrame::setColor(TQColor c)
{
m_color = c;
- repaint(false);
+ tqrepaint(false);
}
-QColor CropFrame::color()
+TQColor CropFrame::color()
{
return m_color;
}