summaryrefslogtreecommitdiffstats
path: root/src/regiongrabber.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
commitaa0726b20f398264f0a2abc60215be044b106f9c (patch)
tree070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/regiongrabber.cpp
parentd3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff)
downloadbasket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz
basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip
TQt4 port basket
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/regiongrabber.cpp')
-rw-r--r--src/regiongrabber.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/regiongrabber.cpp b/src/regiongrabber.cpp
index f7924e6..f7a1534 100644
--- a/src/regiongrabber.cpp
+++ b/src/regiongrabber.cpp
@@ -21,30 +21,30 @@
#include "regiongrabber.h"
-#include <qapplication.h>
-#include <qpainter.h>
-#include <qpalette.h>
-#include <qstyle.h>
-#include <qtimer.h>
-#include <qtooltip.h>
+#include <tqapplication.h>
+#include <tqpainter.h>
+#include <tqpalette.h>
+#include <tqstyle.h>
+#include <tqtimer.h>
+#include <tqtooltip.h>
#include <kglobalsettings.h>
-SizeTip::SizeTip( QWidget *parent, const char *name )
- : QLabel( parent, name, WStyle_Customize | WX11BypassWM |
+SizeTip::SizeTip( TQWidget *tqparent, const char *name )
+ : TQLabel( tqparent, name, WStyle_Customize | WX11BypassWM |
WStyle_StaysOnTop | WStyle_NoBorder | WStyle_Tool )
{
setMargin( 2 );
setIndent( 0 );
- setFrameStyle( QFrame::Plain | QFrame::Box );
+ setFrameStyle( TQFrame::Plain | TQFrame::Box );
- setPalette( QToolTip::palette() );
+ setPalette( TQToolTip::palette() );
}
-void SizeTip::setTip( const QRect &rect )
+void SizeTip::setTip( const TQRect &rect )
{
- QString tip = QString( "%1x%2" ).arg( rect.width() )
- .arg( rect.height() );
+ TQString tip = TQString( "%1x%2" ).tqarg( rect.width() )
+ .tqarg( rect.height() );
setText( tip );
adjustSize();
@@ -52,33 +52,33 @@ void SizeTip::setTip( const QRect &rect )
positionTip( rect );
}
-void SizeTip::positionTip( const QRect &rect )
+void SizeTip::positionTip( const TQRect &rect )
{
- QRect tipRect = geometry();
- tipRect.moveTopLeft( QPoint( 0, 0 ) );
+ TQRect tipRect = tqgeometry();
+ tipRect.moveTopLeft( TQPoint( 0, 0 ) );
if ( rect.intersects( tipRect ) )
{
- QRect deskR = KGlobalSettings::desktopGeometry( QPoint( 0, 0 ) );
+ TQRect deskR = KGlobalSettings::desktopGeometry( TQPoint( 0, 0 ) );
- tipRect.moveCenter( QPoint( deskR.width()/2, deskR.height()/2 ) );
- if ( !rect.contains( tipRect, true ) && rect.intersects( tipRect ) )
- tipRect.moveBottomRight( geometry().bottomRight() );
+ tipRect.moveCenter( TQPoint( deskR.width()/2, deskR.height()/2 ) );
+ if ( !rect.tqcontains( tipRect, true ) && rect.intersects( tipRect ) )
+ tipRect.moveBottomRight( tqgeometry().bottomRight() );
}
move( tipRect.topLeft() );
}
RegionGrabber::RegionGrabber(int delay)
- : QWidget( 0, 0 ),
+ : TQWidget( 0, 0 ),
mouseDown( false ), sizeTip( 0L )
{
- sizeTip = new SizeTip( ( QWidget * )0L );
+ sizeTip = new SizeTip( ( TQWidget * )0L );
- tipTimer = new QTimer( this );
- connect( tipTimer, SIGNAL( timeout() ), SLOT( updateSizeTip() ) );
+ tipTimer = new TQTimer( this );
+ connect( tipTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( updateSizeTip() ) );
- QTimer::singleShot( delay, this, SLOT( initGrabber() ) );
+ TQTimer::singleShot( delay, this, TQT_SLOT( initGrabber() ) );
}
RegionGrabber::~RegionGrabber()
@@ -88,33 +88,33 @@ RegionGrabber::~RegionGrabber()
void RegionGrabber::initGrabber()
{
- pixmap = QPixmap::grabWindow( qt_xrootwin() );
+ pixmap = TQPixmap::grabWindow( qt_xrootwin() );
setPaletteBackgroundPixmap( pixmap );
- QDesktopWidget desktopWidget;
- QRect desktopSize;
+ TQDesktopWidget desktopWidget;
+ TQRect desktopSize;
if ( desktopWidget.isVirtualDesktop() )
- desktopSize = desktopWidget.geometry();
+ desktopSize = desktopWidget.tqgeometry();
else
desktopSize = desktopWidget.screenGeometry( qt_xrootwin() );
setGeometry( desktopSize );
showFullScreen();
- QApplication::setOverrideCursor( crossCursor );
+ TQApplication::setOverrideCursor( crossCursor );
}
-void RegionGrabber::mousePressEvent( QMouseEvent *e )
+void RegionGrabber::mousePressEvent( TQMouseEvent *e )
{
- if ( e->button() == LeftButton )
+ if ( e->button() == Qt::LeftButton )
{
mouseDown = true;
- grabRect = QRect( e->pos(), e->pos() );
+ grabRect = TQRect( e->pos(), e->pos() );
drawRubber();
}
}
-void RegionGrabber::mouseMoveEvent( QMouseEvent *e )
+void RegionGrabber::mouseMoveEvent( TQMouseEvent *e )
{
if ( mouseDown )
{
@@ -127,7 +127,7 @@ void RegionGrabber::mouseMoveEvent( QMouseEvent *e )
}
}
-void RegionGrabber::mouseReleaseEvent( QMouseEvent *e )
+void RegionGrabber::mouseReleaseEvent( TQMouseEvent *e )
{
mouseDown = false;
drawRubber();
@@ -136,20 +136,20 @@ void RegionGrabber::mouseReleaseEvent( QMouseEvent *e )
grabRect.setBottomRight( e->pos() );
grabRect = grabRect.normalize();
- QPixmap region = QPixmap::grabWindow( winId(), grabRect.x(), grabRect.y(),
+ TQPixmap region = TQPixmap::grabWindow( winId(), grabRect.x(), grabRect.y(),
grabRect.width(), grabRect.height() );
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
emit regionGrabbed( region );
}
-void RegionGrabber::keyPressEvent( QKeyEvent *e )
+void RegionGrabber::keyPressEvent( TQKeyEvent *e )
{
if ( e->key() == Key_Escape )
{
- QApplication::restoreOverrideCursor();
- emit regionGrabbed( QPixmap() );
+ TQApplication::restoreOverrideCursor();
+ emit regionGrabbed( TQPixmap() );
}
else
e->ignore();
@@ -157,7 +157,7 @@ void RegionGrabber::keyPressEvent( QKeyEvent *e )
void RegionGrabber::updateSizeTip()
{
- QRect rect = grabRect.normalize();
+ TQRect rect = grabRect.normalize();
sizeTip->setTip( rect );
sizeTip->show();
@@ -165,14 +165,14 @@ void RegionGrabber::updateSizeTip()
void RegionGrabber::drawRubber()
{
- QPainter p;
+ TQPainter p;
p.begin( this );
p.setRasterOp( NotROP );
- p.setPen( QPen( color0, 1 ) );
+ p.setPen( TQPen( color0, 1 ) );
p.setBrush( NoBrush );
- style().drawPrimitive( QStyle::PE_FocusRect, &p, grabRect, colorGroup(),
- QStyle::Style_Default, QStyleOption( colorGroup().base() ) );
+ tqstyle().tqdrawPrimitive( TQStyle::PE_FocusRect, &p, grabRect, tqcolorGroup(),
+ TQStyle::Style_Default, TQStyleOption( tqcolorGroup().base() ) );
p.end();
}