diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /karbon/widgets/vcanvas.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-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 'karbon/widgets/vcanvas.cc')
-rw-r--r-- | karbon/widgets/vcanvas.cc | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/karbon/widgets/vcanvas.cc b/karbon/widgets/vcanvas.cc index c3c91670..28b272ae 100644 --- a/karbon/widgets/vcanvas.cc +++ b/karbon/widgets/vcanvas.cc @@ -17,9 +17,9 @@ * Boston, MA 02110-1301, USA. */ -#include <qcursor.h> -#include <qpainter.h> -#include <qpixmap.h> +#include <tqcursor.h> +#include <tqpainter.h> +#include <tqpixmap.h> #include "karbon_view.h" #include "karbon_part.h" @@ -67,15 +67,15 @@ KoPoint VCanvas::snapToGrid( const KoPoint &point ) KoSize dist = m_part->document().grid().snap; KoSize dxy = m_part->document().grid().freq; - int dx = qRound( p.x() / dxy.width() ); - int dy = qRound( p.y() / dxy.height() ); + int dx = tqRound( p.x() / dxy.width() ); + int dy = tqRound( p.y() / dxy.height() ); - float distx = QMIN( QABS( p.x() - dxy.width() * dx ), QABS( p.x() - dxy.width() * ( dx + 1 ) ) ); - float disty = QMIN( QABS( p.y() - dxy.height() * dy ), QABS( p.y() - dxy.height() * ( dy + 1 ) ) ); + float distx = TQMIN( TQABS( p.x() - dxy.width() * dx ), TQABS( p.x() - dxy.width() * ( dx + 1 ) ) ); + float disty = TQMIN( TQABS( p.y() - dxy.height() * dy ), TQABS( p.y() - dxy.height() * ( dy + 1 ) ) ); if( distx < dist.width() ) { - if( QABS(p.x() - dxy.width() * dx ) < QABS( p.x() - dxy.width() * ( dx + 1 ) ) ) + if( TQABS(p.x() - dxy.width() * dx ) < TQABS( p.x() - dxy.width() * ( dx + 1 ) ) ) p.rx() = dxy.width() * dx; else p.rx() = dxy.width() * ( dx + 1 ); @@ -83,7 +83,7 @@ KoPoint VCanvas::snapToGrid( const KoPoint &point ) if( disty < dist.height() ) { - if( QABS( p.y() - dxy.height() * dy ) < QABS( p.y() - dxy.height() * ( dy + 1 ) ) ) + if( TQABS( p.y() - dxy.height() * dy ) < TQABS( p.y() - dxy.height() * ( dy + 1 ) ) ) p.ry() = dxy.height() * dy; else p.ry() = dxy.height() * ( dy + 1 ); @@ -93,22 +93,22 @@ KoPoint VCanvas::snapToGrid( const KoPoint &point ) } -VCanvas::VCanvas( QWidget *parent, KarbonView* view, KarbonPart* part ) - : QScrollView( parent, "canvas", WStaticContents/*WNorthWestGravity*/ | WResizeNoErase | +VCanvas::VCanvas( TQWidget *tqparent, KarbonView* view, KarbonPart* part ) + : TQScrollView( tqparent, "canvas", WStaticContents/*WNorthWestGravity*/ | WResizeNoErase | WRepaintNoErase ), m_part( part ), m_view( view ) { - connect(this, SIGNAL( contentsMoving( int, int ) ), this, SLOT( slotContentsMoving( int, int ) ) ); - viewport()->setFocusPolicy( QWidget::StrongFocus ); + connect(this, TQT_SIGNAL( contentsMoving( int, int ) ), this, TQT_SLOT( slotContentsMoving( int, int ) ) ); + viewport()->setFocusPolicy( TQ_StrongFocus ); viewport()->setMouseTracking( true ); setMouseTracking( true ); - viewport()->setBackgroundColor( Qt::white ); - viewport()->setBackgroundMode( QWidget::NoBackground ); + viewport()->setBackgroundColor( TQt::white ); + viewport()->setBackgroundMode( TQWidget::NoBackground ); viewport()->installEventFilter( this ); resizeContents( 800, 600 ); - m_pixmap = new QPixmap( 800, 600 ); + m_pixmap = new TQPixmap( 800, 600 ); setFocus(); @@ -126,21 +126,21 @@ void VCanvas::setPos( const KoPoint& p ) { KoPoint p2 = toViewport( p ); - QCursor::setPos( mapToGlobal( QPoint( int(p2.x()), int(p2.y()) ) ) ); + TQCursor::setPos( mapToGlobal( TQPoint( int(p2.x()), int(p2.y()) ) ) ); } bool -VCanvas::eventFilter( QObject* object, QEvent* event ) +VCanvas::eventFilter( TQObject* object, TQEvent* event ) { - QScrollView::eventFilter( object, event ); + TQScrollView::eventFilter( object, event ); - if( event->type() == QEvent::AccelOverride || event->type() == QEvent::Accel ) - return QScrollView::eventFilter( object, event ); + if( event->type() == TQEvent::AccelOverride || event->type() == TQEvent::Accel ) + return TQScrollView::eventFilter( object, event ); - if( event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease ) + if( event->type() == TQEvent::KeyPress || event->type() == TQEvent::KeyRelease ) return m_view->keyEvent( event ); - QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>( event ); + TQMouseEvent* mouseEvent = dynamic_cast<TQMouseEvent*>( event ); if( mouseEvent && m_view ) { @@ -152,9 +152,9 @@ VCanvas::eventFilter( QObject* object, QEvent* event ) } -// This causes a repaint normally, so just overwriting it omits the repainting +// This causes a tqrepaint normally, so just overwriting it omits the tqrepainting void -VCanvas::focusInEvent( QFocusEvent * ) +VCanvas::focusInEvent( TQFocusEvent * ) { } @@ -198,7 +198,7 @@ VCanvas::boundingBox() const void VCanvas::setYMirroring( VPainter *p ) { - QWMatrix mat; + TQWMatrix mat; mat.scale( 1, -1 ); mat.translate( pageOffsetX(), pageOffsetY() ); @@ -212,10 +212,10 @@ VCanvas::setYMirroring( VPainter *p ) } void -VCanvas::viewportPaintEvent( QPaintEvent *e ) +VCanvas::viewportPaintEvent( TQPaintEvent *e ) { - QRect eventRect = e->rect(); - KoRect rect = KoRect::fromQRect( eventRect ); + TQRect eventRect = e->rect(); + KoRect rect = KoRect::fromTQRect( eventRect ); setYMirroring( m_view->painterFactory()->editpainter() ); viewport()->setUpdatesEnabled( false ); @@ -223,12 +223,12 @@ VCanvas::viewportPaintEvent( QPaintEvent *e ) // TODO : only update ROIs p->begin(); - p->clear( rect, QColor( 195, 194, 193 ) ); + p->clear( rect, TQColor( 195, 194, 193 ) ); p->setZoomFactor( m_view->zoom() ); setYMirroring( p ); // TRICK : slightly adjust the matrix so libart AA looks better - QWMatrix mat = p->worldMatrix(); + TQWMatrix mat = p->tqworldMatrix(); p->setWorldMatrix( mat.translate( -.5, -.5 ) ); // set up clippath @@ -248,7 +248,7 @@ VCanvas::viewportPaintEvent( QPaintEvent *e ) p->end(); // draw handle: - VQPainter qpainter( p->device() ); + VTQPainter qpainter( p->device() ); setYMirroring( &qpainter ); qpainter.setZoomFactor( m_view->zoom() ); m_part->document().selection()->draw( &qpainter, m_view->zoom() ); @@ -286,14 +286,14 @@ VCanvas::setViewportRect( const KoRect &r ) } void -VCanvas::drawContents( QPainter* painter, int clipx, int clipy, +VCanvas::drawContents( TQPainter* painter, int clipx, int clipy, int clipw, int cliph ) { drawDocument( painter, KoRect( clipx, clipy, clipw, cliph ) ); } void -VCanvas::drawDocument( QPainter* /*painter*/, const KoRect&, bool drawVObjects ) +VCanvas::drawDocument( TQPainter* /*painter*/, const KoRect&, bool drawVObjects ) { setYMirroring( m_view->painterFactory()->editpainter() ); @@ -301,11 +301,11 @@ VCanvas::drawDocument( QPainter* /*painter*/, const KoRect&, bool drawVObjects ) if( drawVObjects ) { p->begin(); - p->clear( QColor( 195, 194, 193 ) ); + p->clear( TQColor( 195, 194, 193 ) ); p->setZoomFactor( m_view->zoom() ); setYMirroring( p ); // TRICK : slightly adjust the matrix so libart AA looks better - QWMatrix mat = p->worldMatrix(); + TQWMatrix mat = p->tqworldMatrix(); p->setWorldMatrix( mat.translate( -.5, -.5 ) ); m_part->document().drawPage( p, m_part->pageLayout(), m_view->showPageMargins() ); @@ -316,7 +316,7 @@ VCanvas::drawDocument( QPainter* /*painter*/, const KoRect&, bool drawVObjects ) } // draw handle: - VQPainter qpainter( p->device() ); + VTQPainter qpainter( p->device() ); setYMirroring( &qpainter ); qpainter.setZoomFactor( m_view->zoom() ); m_part->document().selection()->draw( &qpainter, m_view->zoom() ); @@ -328,33 +328,33 @@ VCanvas::drawDocument( QPainter* /*painter*/, const KoRect&, bool drawVObjects ) } void -VCanvas::repaintAll( bool drawVObjects ) +VCanvas::tqrepaintAll( bool drawVObjects ) { drawDocument( 0, KoRect( 0, 0, width(), height() ), drawVObjects ); } -/// repaints just a rect area (no scrolling) +/// tqrepaints just a rect area (no scrolling) void -VCanvas::repaintAll( const KoRect &r ) +VCanvas::tqrepaintAll( const KoRect &r ) { drawDocument( 0, r ); } void -VCanvas::resizeEvent( QResizeEvent* event ) +VCanvas::resizeEvent( TQResizeEvent* event ) { double centerX = double( contentsX() + 0.5 * visibleWidth() ) / double( contentsWidth() ); double centerY = double( contentsY() + 0.5 * visibleHeight() ) / double( contentsHeight() ); - QScrollView::resizeEvent( event ); + TQScrollView::resizeEvent( event ); if( !m_pixmap ) - m_pixmap = new QPixmap( width(), height() ); + m_pixmap = new TQPixmap( width(), height() ); else m_pixmap->resize( width(), height() ); VPainter *p = m_view->painterFactory()->painter(); p->resize( width(), height() ); - p->clear( QColor( 195, 194, 193 ) ); + p->clear( TQColor( 195, 194, 193 ) ); setViewport( centerX, centerY ); } @@ -365,13 +365,13 @@ VCanvas::slotContentsMoving( int /*x*/, int /*y*/ ) } void -VCanvas::dragEnterEvent( QDragEnterEvent *e ) +VCanvas::dragEnterEvent( TQDragEnterEvent *e ) { e->accept( KarbonDrag::canDecode( e ) || KColorDrag::canDecode( e ) ); } void -VCanvas::dropEvent( QDropEvent *e ) +VCanvas::dropEvent( TQDropEvent *e ) { m_view->dropEvent( e ); } |