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

List:       kde-commits
Subject:    extragear/graphics/gwenview
From:       Aurélien Gâteau <aurelien.gateau () free ! fr>
Date:       2005-07-28 21:52:17
Message-ID: 1122587537.729705.14967.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 439773 by gateau:

New feature by Michael Rolf: scroll the image with the keyboard


 M  +2 -0      NEWS  
 M  +32 -0     gvcore/imageview.cpp  
 M  +1 -0      gvcore/imageview.h  


--- trunk/extragear/graphics/gwenview/NEWS #439772:439773
@@ -6,6 +6,8 @@
    - Alt+Backspace goes to the previous folder
    - Alt+Space goes to the next folder
    (Patch by Michael Rolf)
+ - It's now possible to scroll images with the keyboards
+   (Patch by Michael Rolf)
 - Fixes:
  - In the thumbnail view, make sure we always show folder and archive
    filenames, even if the filename is not shown for images.
--- trunk/extragear/graphics/gwenview/gvcore/imageview.cpp #439772:439773
@@ -1110,6 +1110,38 @@
 	}
 }
 
+void ImageView::keyPressEvent( QKeyEvent *event ) {
+	QScrollView::keyPressEvent( event );
+	int deltaX, deltaY;
+
+	if (event->state() != Qt::NoButton) {
+		return;
+	}
+	switch (event->key()) {
+	case Key_Up:
+		deltaX =  0;
+		deltaY = -1;
+		break;
+	case Key_Down:
+		deltaX =  0;
+		deltaY =  1;
+		break;
+	case Key_Left:
+		deltaX = -1;
+		deltaY =  0;
+		break;
+	case Key_Right:
+		deltaX =  1;
+		deltaY =  0;
+		break;
+	default:
+		return;
+	}
+	deltaX *= width() / 2;
+	deltaY *= height() / 2;
+	scrollBy (deltaX, deltaY);
+}
+
 /**
  * If force is set, the cursor will be updated even if the tool is not
  * different from the current one.
--- trunk/extragear/graphics/gwenview/gvcore/imageview.h #439772:439773
@@ -141,6 +141,7 @@
 	virtual void openContextMenu(const QPoint&);
 	virtual void contentsDragEnterEvent(QDragEnterEvent*);
 	virtual void contentsDropEvent(QDropEvent*);
+	virtual void keyPressEvent(QKeyEvent*);
 	
 private:
 	struct Private;
[prev in list] [next in list] [prev in thread] [next in thread] 

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