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 /kivio/kiviopart/ui/kivio_birdeye_panel.cpp | |
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 'kivio/kiviopart/ui/kivio_birdeye_panel.cpp')
-rw-r--r-- | kivio/kiviopart/ui/kivio_birdeye_panel.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/kivio/kiviopart/ui/kivio_birdeye_panel.cpp b/kivio/kiviopart/ui/kivio_birdeye_panel.cpp index 6d8b8355..55b88d82 100644 --- a/kivio/kiviopart/ui/kivio_birdeye_panel.cpp +++ b/kivio/kiviopart/ui/kivio_birdeye_panel.cpp @@ -18,32 +18,32 @@ #include <kiconloader.h> #include <kapplication.h> -#include <qpixmap.h> -#include <qslider.h> -#include <qspinbox.h> -#include <qframe.h> -#include <qcursor.h> -#include <qtoolbutton.h> +#include <tqpixmap.h> +#include <tqslider.h> +#include <tqspinbox.h> +#include <tqframe.h> +#include <tqcursor.h> +#include <tqtoolbutton.h> #define TOGGLE_ACTION(X) ((KToggleAction*)child(X)) -KivioBirdEyePanel::KivioBirdEyePanel(KivioView* view, QWidget* parent, const char* name) -: KivioBirdEyePanelBase(parent, name), m_pView(view), m_pCanvas(view->canvasWidget()), m_pDoc(view->doc()) +KivioBirdEyePanel::KivioBirdEyePanel(KivioView* view, TQWidget* tqparent, const char* name) +: KivioBirdEyePanelBase(tqparent, name), m_pView(view), m_pCanvas(view->canvasWidget()), m_pDoc(view->doc()) { handlePress = false; - m_buffer = new QPixmap(); + m_buffer = new TQPixmap(); canvas->installEventFilter(this); m_zoomHandler = new KoZoomHandler; - connect( m_pDoc, SIGNAL( sig_updateView(KivioPage*)), SLOT(slotUpdateView(KivioPage*)) ); - connect( m_pView, SIGNAL(zoomChanged(int)), SLOT(canvasZoomChanged(int))); - connect( m_pCanvas, SIGNAL(visibleAreaChanged()), SLOT(updateView())); + connect( m_pDoc, TQT_SIGNAL( sig_updateView(KivioPage*)), TQT_SLOT(slotUpdateView(KivioPage*)) ); + connect( m_pView, TQT_SIGNAL(zoomChanged(int)), TQT_SLOT(canvasZoomChanged(int))); + connect( m_pCanvas, TQT_SIGNAL(visibleAreaChanged()), TQT_SLOT(updateView())); m_zoomOutButton->setIconSet(SmallIconSet("viewmag-", 16)); m_zoomInButton->setIconSet(SmallIconSet("viewmag+", 16)); - connect(m_zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomMinus())); - connect(m_zoomInButton, SIGNAL(clicked()), this, SLOT(zoomPlus())); - connect(m_zoomSlider, SIGNAL(valueChanged(int)), m_pView, SLOT(viewZoom(int))); + connect(m_zoomOutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(zoomMinus())); + connect(m_zoomInButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(zoomPlus())); + connect(m_zoomSlider, TQT_SIGNAL(valueChanged(int)), m_pView, TQT_SLOT(viewZoom(int))); canvasZoomChanged(m_pView->zoomHandler()->zoom()); } @@ -56,12 +56,12 @@ KivioBirdEyePanel::~KivioBirdEyePanel() void KivioBirdEyePanel::zoomMinus() { - m_pCanvas->zoomOut(QPoint(m_pCanvas->width() / 2, m_pCanvas->height() / 2)); + m_pCanvas->zoomOut(TQPoint(m_pCanvas->width() / 2, m_pCanvas->height() / 2)); } void KivioBirdEyePanel::zoomPlus() { - m_pCanvas->zoomIn(QPoint(m_pCanvas->width() / 2, m_pCanvas->height() / 2)); + m_pCanvas->zoomIn(TQPoint(m_pCanvas->width() / 2, m_pCanvas->height() / 2)); } void KivioBirdEyePanel::canvasZoomChanged(int zoom) @@ -82,25 +82,25 @@ void KivioBirdEyePanel::slotUpdateView(KivioPage* page) updateView(); } -bool KivioBirdEyePanel::eventFilter(QObject* o, QEvent* ev) +bool KivioBirdEyePanel::eventFilter(TQObject* o, TQEvent* ev) { - if (o == canvas && ev->type() == QEvent::Show) { + if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(canvas) && ev->type() == TQEvent::Show) { updateView(); } - if (o == canvas && ev->type() == QEvent::Resize) { + if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(canvas) && ev->type() == TQEvent::Resize) { m_buffer->resize(canvas->size()); slotUpdateView(m_pView->activePage()); } - if (o == canvas && ev->type() == QEvent::Paint) { + if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(canvas) && ev->type() == TQEvent::Paint) { updateView(); return true; } - if (o == canvas && ev->type() == QEvent::MouseMove) { - QMouseEvent* me = (QMouseEvent*)ev; - if (me->state() == LeftButton) + if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(canvas) && ev->type() == TQEvent::MouseMove) { + TQMouseEvent* me = TQT_TQMOUSEEVENT(ev); + if (me->state() == Qt::LeftButton) handleMouseMoveAction(me->pos()); else handleMouseMove(me->pos()); @@ -109,9 +109,9 @@ bool KivioBirdEyePanel::eventFilter(QObject* o, QEvent* ev) return true; } - if (o == canvas && ev->type() == QEvent::MouseButtonPress) { - QMouseEvent* me = (QMouseEvent*)ev; - if (me->button() == LeftButton) + if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(canvas) && ev->type() == TQEvent::MouseButtonPress) { + TQMouseEvent* me = TQT_TQMOUSEEVENT(ev); + if (me->button() == Qt::LeftButton) handleMousePress(me->pos()); return true; @@ -130,14 +130,14 @@ void KivioBirdEyePanel::updateView() int pw = m_zoomHandler->zoomItX(pl.ptWidth); int ph = m_zoomHandler->zoomItY(pl.ptHeight); - QSize s2 = QSize(pw,ph); - QSize s1 = canvas->size(); + TQSize s2 = TQSize(pw,ph); + TQSize s1 = canvas->size(); double zx = (double)s1.width()/(double)s2.width(); double zy = (double)s1.height()/(double)s2.height(); - double zxy = QMIN(zx,zy); + double zxy = TQMIN(zx,zy); - m_zoomHandler->setZoomAndResolution(qRound(zxy * 100), KoGlobal::dpiX(), + m_zoomHandler->setZoomAndResolution(tqRound(zxy * 100), KoGlobal::dpiX(), KoGlobal::dpiY()); pw = m_zoomHandler->zoomItX(pl.ptWidth); @@ -145,13 +145,13 @@ void KivioBirdEyePanel::updateView() int px0 = (s1.width()-pw)/2; int py0 = (s1.height()-ph)/2; - QPoint p0 = QPoint(px0,py0); + TQPoint p0 = TQPoint(px0,py0); - QRect rect(QPoint(0,0),s1); + TQRect rect(TQPoint(0,0),s1); KivioScreenPainter kpainter; - kpainter.start(m_buffer); - kpainter.painter()->fillRect(rect, KApplication::palette().active().brush(QColorGroup::Mid)); + kpainter.start(TQT_TQPAINTDEVICE(m_buffer)); + kpainter.painter()->fillRect(rect, KApplication::tqpalette().active().brush(TQColorGroup::Mid)); kpainter.painter()->fillRect(px0, py0, pw, ph, white); @@ -176,39 +176,39 @@ void KivioBirdEyePanel::updateView() bitBlt(canvas,0,0,m_buffer); } -void KivioBirdEyePanel::handleMouseMove(QPoint p) +void KivioBirdEyePanel::handleMouseMove(TQPoint p) { handlePress = true; - QRect r1 = QRect(varea.x()-1, varea.y()-1, 3, varea.height()+2); - if (r1.contains(p)) { + TQRect r1 = TQRect(varea.x()-1, varea.y()-1, 3, varea.height()+2); + if (r1.tqcontains(p)) { canvas->setCursor(sizeHorCursor); apos = AlignLeft; return; } r1.moveBy(varea.width(),0); - if (r1.contains(p)) { + if (r1.tqcontains(p)) { canvas->setCursor(sizeHorCursor); apos = AlignRight; return; } - QRect r2 = QRect(varea.x()-1, varea.y()-1, varea.width()+2, 3); - if (r2.contains(p)) { + TQRect r2 = TQRect(varea.x()-1, varea.y()-1, varea.width()+2, 3); + if (r2.tqcontains(p)) { canvas->setCursor(sizeVerCursor); apos = AlignTop; return; } r2.moveBy(0, varea.height()); - if (r2.contains(p)) { + if (r2.tqcontains(p)) { canvas->setCursor(sizeVerCursor); apos = AlignBottom; return; } - if (varea.contains(p)) { + if (varea.tqcontains(p)) { canvas->setCursor(sizeAllCursor); apos = AlignCenter; return; @@ -218,7 +218,7 @@ void KivioBirdEyePanel::handleMouseMove(QPoint p) handlePress = false; } -void KivioBirdEyePanel::handleMouseMoveAction(QPoint p) +void KivioBirdEyePanel::handleMouseMoveAction(TQPoint p) { if (!handlePress) return; @@ -240,31 +240,31 @@ void KivioBirdEyePanel::handleMouseMoveAction(QPoint p) KoRect vr = m_pCanvas->visibleArea(); if (apos == AlignRight) { - vr.setWidth(QMAX(10.0, vr.width() + dx)); + vr.setWidth(TQMAX(10.0, vr.width() + dx)); m_pCanvas->setVisibleAreaByWidth(vr); } else if (apos == AlignLeft) { vr.setX(vr.x() + dx); - vr.setWidth(QMAX(10.0, vr.width() - dx)); + vr.setWidth(TQMAX(10.0, vr.width() - dx)); m_pCanvas->setVisibleAreaByWidth(vr); } else if (apos == AlignTop) { vr.setY(vr.y() + dy); - vr.setHeight(QMAX(10.0 ,vr.height() - dy)); + vr.setHeight(TQMAX(10.0 ,vr.height() - dy)); m_pCanvas->setVisibleAreaByHeight(vr); } else if (apos == AlignBottom) { - vr.setHeight(QMAX(10.0 ,vr.height() + dy)); + vr.setHeight(TQMAX(10.0 ,vr.height() + dy)); m_pCanvas->setVisibleAreaByHeight(vr); } } -void KivioBirdEyePanel::handleMousePress(QPoint p) +void KivioBirdEyePanel::handleMousePress(TQPoint p) { if (handlePress) return; - QSize s1 = canvas->size(); + TQSize s1 = canvas->size(); KoPageLayout pl = m_pView->activePage()->paperLayout(); int pw = m_zoomHandler->zoomItX(pl.ptWidth); int ph = m_zoomHandler->zoomItY(pl.ptHeight); |