summaryrefslogtreecommitdiffstats
path: root/src/resizeoverlay.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
commit87a016680e3677da3993f333561e79eb0cead7d5 (patch)
treecbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/resizeoverlay.cpp
parent6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff)
downloadktechlab-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/resizeoverlay.cpp')
-rw-r--r--src/resizeoverlay.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/resizeoverlay.cpp b/src/resizeoverlay.cpp
index 9d714bd..6c45f93 100644
--- a/src/resizeoverlay.cpp
+++ b/src/resizeoverlay.cpp
@@ -13,16 +13,16 @@
#include "resizeoverlay.h"
#include <kdebug.h>
-#include <qpainter.h>
+#include <tqpainter.h>
//BEGIN class ResizeOverlay
-ResizeOverlay::ResizeOverlay( Item *parent )
- : QObject(parent)
+ResizeOverlay::ResizeOverlay( Item *tqparent )
+ : TQObject(tqparent)
{
b_showResizeHandles = false;
b_visible = true;
- p_item = parent;
+ p_item = tqparent;
}
@@ -45,7 +45,7 @@ void ResizeOverlay::showResizeHandles( bool show )
const ResizeHandleMap::iterator end = m_resizeHandleMap.end();
for ( ResizeHandleMap::iterator it = m_resizeHandleMap.begin(); it != end; ++it )
{
- it.data()->setVisible(b_showResizeHandles && b_visible);
+ it.data()->tqsetVisible(b_showResizeHandles && b_visible);
}
}
@@ -56,32 +56,32 @@ void ResizeOverlay::setVisible( bool visible )
const ResizeHandleMap::iterator end = m_resizeHandleMap.end();
for ( ResizeHandleMap::iterator it = m_resizeHandleMap.begin(); it != end; ++it )
{
- it.data()->setVisible(b_showResizeHandles && b_visible);
+ it.data()->tqsetVisible(b_showResizeHandles && b_visible);
}
}
ResizeHandle *ResizeOverlay::createResizeHandle( int id, ResizeHandle::DrawType drawType, int xsnap, int ysnap )
{
- ResizeHandleMap::iterator it = m_resizeHandleMap.find(id);
+ ResizeHandleMap::iterator it = m_resizeHandleMap.tqfind(id);
if ( it != m_resizeHandleMap.end() )
return it.data();
ResizeHandle *newResizeHandle = new ResizeHandle( this, id, drawType, xsnap, ysnap );
m_resizeHandleMap[id] = newResizeHandle;
- connect( newResizeHandle, SIGNAL(rhMovedBy(int, double, double )), this, SLOT(slotResizeHandleMoved(int, double, double )) );
+ connect( newResizeHandle, TQT_SIGNAL(rhMovedBy(int, double, double )), this, TQT_SLOT(slotResizeHandleMoved(int, double, double )) );
return newResizeHandle;
}
void ResizeOverlay::removeResizeHandle( int id )
{
- ResizeHandleMap::iterator it = m_resizeHandleMap.find(id);
+ ResizeHandleMap::iterator it = m_resizeHandleMap.tqfind(id);
if ( it == m_resizeHandleMap.end() )
return;
ResizeHandle *rh = it.data();
- disconnect( rh, SIGNAL(rhMovedBy(int, double, double )), this, SLOT(slotResizeHandleMoved(int, double, double )) );
+ disconnect( rh, TQT_SIGNAL(rhMovedBy(int, double, double )), this, TQT_SLOT(slotResizeHandleMoved(int, double, double )) );
delete rh;
m_resizeHandleMap.erase(it);
}
@@ -89,7 +89,7 @@ void ResizeOverlay::removeResizeHandle( int id )
ResizeHandle *ResizeOverlay::resizeHandle( int id )
{
- ResizeHandleMap::iterator it = m_resizeHandleMap.find(id);
+ ResizeHandleMap::iterator it = m_resizeHandleMap.tqfind(id);
if ( it != m_resizeHandleMap.end() )
return it.data();
return 0l;
@@ -122,27 +122,27 @@ void ResizeOverlay::syncX( ResizeHandle *rh1, ResizeHandle *rh2 )
{
if ( !rh1 || !rh2 )
return;
- connect( rh1, SIGNAL(rhMovedByX(double )), rh2, SLOT(slotMoveByX(double )) );
- connect( rh2, SIGNAL(rhMovedByX(double )), rh1, SLOT(slotMoveByX(double )) );
+ connect( rh1, TQT_SIGNAL(rhMovedByX(double )), rh2, TQT_SLOT(slotMoveByX(double )) );
+ connect( rh2, TQT_SIGNAL(rhMovedByX(double )), rh1, TQT_SLOT(slotMoveByX(double )) );
}
void ResizeOverlay::syncY( ResizeHandle *rh1, ResizeHandle *rh2 )
{
if ( !rh1 || !rh2 )
return;
- connect( rh1, SIGNAL(rhMovedByY(double )), rh2, SLOT(slotMoveByY(double )) );
- connect( rh2, SIGNAL(rhMovedByY(double )), rh1, SLOT(slotMoveByY(double )) );
+ connect( rh1, TQT_SIGNAL(rhMovedByY(double )), rh2, TQT_SLOT(slotMoveByY(double )) );
+ connect( rh2, TQT_SIGNAL(rhMovedByY(double )), rh1, TQT_SLOT(slotMoveByY(double )) );
}
//END class ResizeOverlay
//BEGIN class MechanicsItemOverlay
-MechanicsItemOverlay::MechanicsItemOverlay( MechanicsItem *parent )
- : ResizeOverlay(parent)
+MechanicsItemOverlay::MechanicsItemOverlay( MechanicsItem *tqparent )
+ : ResizeOverlay(tqparent)
{
- p_mechanicsItem = parent;
- connect( parent, SIGNAL(moved()), this, SLOT(slotUpdateResizeHandles()) );
- connect( parent, SIGNAL(resized()), this, SLOT(slotUpdateResizeHandles()) );
+ p_mechanicsItem = tqparent;
+ connect( tqparent, TQT_SIGNAL(moved()), this, TQT_SLOT(slotUpdateResizeHandles()) );
+ connect( tqparent, TQT_SIGNAL(resized()), this, TQT_SLOT(slotUpdateResizeHandles()) );
m_tl = createResizeHandle( ResizeHandle::rhp_topLeft, ResizeHandle::dt_resize_backwardsDiagonal );
m_tm = createResizeHandle( ResizeHandle::rhp_topMiddle, ResizeHandle::dt_resize_vertical );
@@ -164,9 +164,9 @@ MechanicsItemOverlay::~MechanicsItemOverlay()
void MechanicsItemOverlay::slotUpdateResizeHandles()
{
const PositionInfo absPos = p_mechanicsItem->absolutePosition();
- const QRect sizeRect = p_mechanicsItem->sizeRect();
+ const TQRect sizeRect = p_mechanicsItem->sizeRect();
- QPointArray pa(9);
+ TQPointArray pa(9);
pa[0] = sizeRect.topLeft();
pa[2] = sizeRect.topRight();
pa[1] = (pa[0]+pa[2])/2;
@@ -175,9 +175,9 @@ void MechanicsItemOverlay::slotUpdateResizeHandles()
pa[6] = sizeRect.bottomLeft();
pa[5] = (pa[4]+pa[6])/2;
pa[7] = (pa[6]+pa[0])/2;
- pa[8] = QPoint(0,0);
+ pa[8] = TQPoint(0,0);
- QWMatrix m;
+ TQWMatrix m;
m.rotate(absPos.angle()*57.29577951308232);
pa = m.map(pa);
@@ -229,11 +229,11 @@ void MechanicsItemOverlay::slotResizeHandleMoved( int id, double dx, double dy )
//BEGIN class RectangularOverlay
-RectangularOverlay::RectangularOverlay( Item *parent, int xsnap, int ysnap )
- : ResizeOverlay(parent)
+RectangularOverlay::RectangularOverlay( Item *tqparent, int xsnap, int ysnap )
+ : ResizeOverlay(tqparent)
{
- connect( parent, SIGNAL(resized()), this, SLOT(slotUpdateResizeHandles()) );
- connect( parent, SIGNAL(movedBy(double, double )), this, SLOT(slotMoveAllResizeHandles(double, double )) );
+ connect( tqparent, TQT_SIGNAL(resized()), this, TQT_SLOT(slotUpdateResizeHandles()) );
+ connect( tqparent, TQT_SIGNAL(movedBy(double, double )), this, TQT_SLOT(slotMoveAllResizeHandles(double, double )) );
m_tl = createResizeHandle( ResizeHandle::rhp_topLeft, ResizeHandle::dt_resize_backwardsDiagonal, xsnap, ysnap );
m_tm = createResizeHandle( ResizeHandle::rhp_topMiddle, ResizeHandle::dt_resize_vertical, xsnap, ysnap );
@@ -273,7 +273,7 @@ void RectangularOverlay::removeBotMiddle()
void RectangularOverlay::slotUpdateResizeHandles()
{
- const QRect sizeRect = p_item->sizeRect();
+ const TQRect sizeRect = p_item->sizeRect();
int x1 = sizeRect.left() + int(p_item->x());
int x2 = x1 + sizeRect.width();
@@ -319,7 +319,7 @@ void RectangularOverlay::slotResizeHandleMoved( int id, double dx, double dy )
Q_UNUSED(dy);
bool ok;
- QRect sizeRect = getSizeRect(&ok);
+ TQRect sizeRect = getSizeRect(&ok);
if (!ok)
return;
@@ -328,7 +328,7 @@ void RectangularOverlay::slotResizeHandleMoved( int id, double dx, double dy )
}
-QRect RectangularOverlay::getSizeRect( bool *ok, bool *widthOk, bool *heightOk ) const
+TQRect RectangularOverlay::getSizeRect( bool *ok, bool *widthOk, bool *heightOk ) const
{
bool t1,t2,t3;
if (!ok)
@@ -341,12 +341,12 @@ QRect RectangularOverlay::getSizeRect( bool *ok, bool *widthOk, bool *heightOk
int width = int(m_br->x() - m_tl->x());
int height = int(m_br->y() - m_tl->y());
- QRect sizeRect( int(m_tl->x() - p_item->x()),
+ TQRect sizeRect( int(m_tl->x() - p_item->x()),
int(m_tl->y() - p_item->y()),
width, height );
- *widthOk = sizeRect.width() >= p_item->minimumSize().width();
- *heightOk = sizeRect.height() >= p_item->minimumSize().height();
+ *widthOk = sizeRect.width() >= p_item->tqminimumSize().width();
+ *heightOk = sizeRect.height() >= p_item->tqminimumSize().height();
*ok = *widthOk && *heightOk;
return sizeRect;
@@ -356,11 +356,11 @@ QRect RectangularOverlay::getSizeRect( bool *ok, bool *widthOk, bool *heightOk
//BEGIN class LineOverlay
-LineOverlay::LineOverlay( Item * parent )
- : ResizeOverlay(parent)
+LineOverlay::LineOverlay( Item * tqparent )
+ : ResizeOverlay(tqparent)
{
- connect( parent, SIGNAL(resized()), this, SLOT(slotUpdateResizeHandles()) );
- connect( parent, SIGNAL(movedBy(double, double )), this, SLOT(slotMoveAllResizeHandles(double, double )) );
+ connect( tqparent, TQT_SIGNAL(resized()), this, TQT_SLOT(slotUpdateResizeHandles()) );
+ connect( tqparent, TQT_SIGNAL(movedBy(double, double )), this, TQT_SLOT(slotMoveAllResizeHandles(double, double )) );
m_pStart = createResizeHandle( ResizeHandle::rhp_start, ResizeHandle::dt_point_rect );
m_pEnd = createResizeHandle( ResizeHandle::rhp_end, ResizeHandle::dt_point_rect );
@@ -369,13 +369,13 @@ LineOverlay::LineOverlay( Item * parent )
}
-QPoint LineOverlay::startPoint() const
+TQPoint LineOverlay::startPoint() const
{
- return QPoint( int(m_pStart->x()), int(m_pStart->y()) );
+ return TQPoint( int(m_pStart->x()), int(m_pStart->y()) );
}
-QPoint LineOverlay::endPoint() const
+TQPoint LineOverlay::endPoint() const
{
- return QPoint( int(m_pEnd->x()), int(m_pEnd->y()) );
+ return TQPoint( int(m_pEnd->x()), int(m_pEnd->y()) );
}
@@ -404,7 +404,7 @@ void LineOverlay::slotResizeHandleMoved( int id, double dx, double dy )
//BEGIN class ResizeHandle
ResizeHandle::ResizeHandle( ResizeOverlay *resizeOverlay, int id, DrawType drawType, int xsnap, int ysnap )
- : QObject(), QCanvasRectangle( 0, 0, 13, 13, resizeOverlay->parentItem()->canvas() )
+ : TQObject(), TQCanvasRectangle( 0, 0, 13, 13, resizeOverlay->tqparentItem()->canvas() )
{
p_resizeOverlay = resizeOverlay;
m_drawType = drawType;
@@ -431,15 +431,15 @@ void ResizeHandle::setHover( bool hover )
return;
b_hover = hover;
- canvas()->setChanged( QRect( int(x())-8, int(y())-8, 15, 15 ) );
+ canvas()->setChanged( TQRect( int(x())-8, int(y())-8, 15, 15 ) );
}
-QPointArray ResizeHandle::areaPoints() const
+TQPointArray ResizeHandle::areaPoints() const
{
-// QPointArray pa = QCanvasRectangle::areaPoints();
+// TQPointArray pa = TQCanvasRectangle::areaPoints();
// pa.translate( -7, -7 );
// return pa;
- return QPointArray( QRect( int(x())-8, int(y())-8, 15, 15 ) );
+ return TQPointArray( TQRect( int(x())-8, int(y())-8, 15, 15 ) );
}
void ResizeHandle::moveRH( double _x, double _y )
@@ -485,12 +485,12 @@ void ResizeHandle::setDrawType( DrawType drawType )
canvas()->setChanged(boundingRect());
}
-void ResizeHandle::drawShape( QPainter &p )
+void ResizeHandle::drawShape( TQPainter &p )
{
- p.drawPixmap( rect().topLeft()-QPoint( 7, 7 ), handlePixmap( m_drawType, b_hover ) );
+ p.drawPixmap( rect().topLeft()-TQPoint( 7, 7 ), handlePixmap( m_drawType, b_hover ) );
}
-const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
+const TQPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
{
const char * resize_forwardsDiagonal_hover_xpm[] = {
"13 13 3 1",
@@ -510,7 +510,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" .+++.. ",
" ....... ",
" "};
- static QPixmap pixmap_forwardsDiagonal_hover(resize_forwardsDiagonal_hover_xpm);
+ static TQPixmap pixmap_forwardsDiagonal_hover(resize_forwardsDiagonal_hover_xpm);
const char * resize_forwardsDiagonal_nohover_xpm[] = {
"13 13 2 1",
@@ -529,7 +529,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ...... ",
" ....... ",
" "};
- static QPixmap pixmap_forwardsDiagonal_nohover(resize_forwardsDiagonal_nohover_xpm);
+ static TQPixmap pixmap_forwardsDiagonal_nohover(resize_forwardsDiagonal_nohover_xpm);
const char * resize_backwardsDiagonal_hover_xpm[] = {
@@ -550,7 +550,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ..+++. ",
" ....... ",
" "};
- static QPixmap pixmap_backwardsDiagonal_hover(resize_backwardsDiagonal_hover_xpm);
+ static TQPixmap pixmap_backwardsDiagonal_hover(resize_backwardsDiagonal_hover_xpm);
const char * resize_backwardsDiagonal_nohover_xpm[] = {
"13 13 2 1",
@@ -569,7 +569,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ...... ",
" ....... ",
" "};
- static QPixmap pixmap_backwardsDiagonal_nohover(resize_backwardsDiagonal_nohover_xpm);
+ static TQPixmap pixmap_backwardsDiagonal_nohover(resize_backwardsDiagonal_nohover_xpm);
const char * resize_vertical_hover_xpm[] = {
@@ -590,7 +590,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ..+.. ",
" ... ",
" . "};
- static QPixmap pixmap_vertical_hover(resize_vertical_hover_xpm);
+ static TQPixmap pixmap_vertical_hover(resize_vertical_hover_xpm);
const char * resize_vertical_nohover_xpm[] = {
"13 13 2 1",
@@ -609,7 +609,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ..... ",
" ... ",
" . "};
- static QPixmap pixmap_vertical_nohover(resize_vertical_nohover_xpm);
+ static TQPixmap pixmap_vertical_nohover(resize_vertical_nohover_xpm);
const char * resize_horizontal_hover_xpm[] = {
@@ -630,7 +630,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" . . ",
" ",
" "};
- static QPixmap pixmap_horizontal_hover(resize_horizontal_hover_xpm);
+ static TQPixmap pixmap_horizontal_hover(resize_horizontal_hover_xpm);
const char * resize_horizontal_nohover_xpm[] = {
"13 13 2 1",
@@ -649,7 +649,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" . . ",
" ",
" "};
- static QPixmap pixmap_horizontal_nohover(resize_horizontal_nohover_xpm);
+ static TQPixmap pixmap_horizontal_nohover(resize_horizontal_nohover_xpm);
const char * point_rect_hover_xpm[] = {
"13 13 3 1",
@@ -669,7 +669,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ",
" ",
" "};
- static QPixmap pixmap_point_rect_hover(point_rect_hover_xpm);
+ static TQPixmap pixmap_point_rect_hover(point_rect_hover_xpm);
const char * point_rect_nohover_xpm[] = {
"13 13 3 1",
@@ -689,7 +689,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
" ",
" ",
" "};
- static QPixmap pixmap_point_rect_nohover(point_rect_nohover_xpm);
+ static TQPixmap pixmap_point_rect_nohover(point_rect_nohover_xpm);
if (hover)
{
@@ -738,7 +738,7 @@ const QPixmap& ResizeHandle::handlePixmap( DrawType drawType, bool hover )
}
}
- static QPixmap blank;
+ static TQPixmap blank;
return blank;
}
//END class ResizeHandle