[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kde4/kdegraphics/ksnapshot
From:       Maks Orlovich <maksim () kde ! org>
Date:       2005-06-01 1:50:04
Message-ID: 1117590604.733018.17622.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 420413 by orlovich:

ksnapshot builds and mostly works..


 M  +6 -17     regiongrabber.cpp  
 M  +2 -2      regiongrabber.h  


--- branches/work/kde4/kdegraphics/ksnapshot/regiongrabber.cpp #420412:420413
@@ -32,6 +32,7 @@
 #include <QKeyEvent>
 
 #include <QX11Info>
+#include <QRubberBand>
 
 #include <kglobalsettings.h>
 
@@ -79,6 +80,7 @@
     mouseDown( false ), sizeTip( 0L )
 {
   sizeTip = new SizeTip( ( QWidget * )0L );
+  band    = new QRubberBand( QRubberBand::Rectangle, this );
 
   tipTimer = new QTimer( this );
   connect( tipTimer, SIGNAL( timeout() ), SLOT( updateSizeTip() ) );
@@ -107,6 +109,8 @@
   {
     mouseDown = true;
     grabRect = QRect( e->pos(), e->pos() );
+    band->setGeometry( grabRect );
+    band->show();
   }
 }
 
@@ -117,16 +121,15 @@
     sizeTip->hide();
     tipTimer->start( 250, true );
 
-    drawRubber();
     grabRect.setBottomRight( e->pos() );
-    drawRubber();
+    band->setGeometry( grabRect );
   }
 }
 
 void RegionGrabber::mouseReleaseEvent( QMouseEvent *e )
 {
   mouseDown = false;
-  drawRubber();
+  band->hide();
   sizeTip->hide();
 
   grabRect.setBottomRight( e->pos() );
@@ -159,18 +162,4 @@
   sizeTip->show();
 }
 
-void RegionGrabber::drawRubber()
-{
-  QPainter p;
-  p.begin( this );
-  p.setRasterOp( NotROP );
-  p.setPen( QPen( color0, 1 ) );
-  p.setBrush( NoBrush );
-
-  style().drawPrimitive( QStyle::PE_FocusRect, &p, grabRect, colorGroup(),
-      QStyle::Style_Default, QStyleOption( colorGroup().base() ) );
-
-  p.end();
-}
-
 #include "regiongrabber.moc"
--- branches/work/kde4/kdegraphics/ksnapshot/regiongrabber.h #420412:420413
@@ -27,6 +27,7 @@
 #include <QKeyEvent>
 
 class QTimer;
+class QRubberBand;
 
 class SizeTip : public QLabel
 {
@@ -59,14 +60,13 @@
     void mouseMoveEvent( QMouseEvent *e );
     void keyPressEvent( QKeyEvent *e );
 
-    void drawRubber();
-
     bool mouseDown;
     QRect grabRect;
     QPixmap pixmap;
 
     SizeTip *sizeTip;
     QTimer *tipTimer;
+    QRubberBand *band;
 };
 
 #endif // REGIONGRABBER_H
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic