Bug 93170

Summary: Screenshot can get cropped (i.e. shown only partially) by resizing window
Product: [Unmaintained] ksnapshot Reporter: Andreas Klöckner <inform>
Component: generalAssignee: Richard Moore <rich>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.7   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andreas Klöckner 2004-11-12 15:15:02 UTC
Version:           0.7 (using KDE 3.3.1,  (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-2)
OS:                Linux (i686) release 2.6.8.1

After taking a fullscreen screenshot, the thumbnail is usually cut off for me (1280x1024 screen) at the top and the bottom. Resizing the window fixes this. Using Plastik style.
Comment 1 Brad Hards 2005-01-30 01:19:19 UTC
Is this just a problem with the thumbnail? That is, is the screenshot itself OK?

You mentioned resizing the window fixes it. If you just resize the ksnapshot window horizontally, does it get fixed? If you just resize the ksnapshot window vertically, does it get fixed?
Comment 2 Andreas Klöckner 2005-01-31 21:33:30 UTC
The screenshot itself is ok. It is purely a problem of the widget displaying it. Horizontal resizing doesn't change anything as the screenshot thumbnail is fully visible in that direction. Vertical resizing does change something.

That is, I can resize the window so that the top and the bottom of the screenshot thumbnail disappear. This is especially visible since the panel seems to "disappear" from the screenshot.
Comment 3 Brad Hards 2005-02-03 08:01:51 UTC
OK, I'm seeing the problem. It is a bit trickier to fix than I first thought - enlarging the window vertically causes horizontal cropping on 1024x768....
Comment 4 Brad Hards 2005-02-14 08:50:51 UTC
CVS commit by bhards: 

Change the way the snapshot preview is displayed, which prevents
it being cut-off at the bottom with some display resolutions.

Thanks to Andreas Klöckner for the bug report and helping
to clarify the issue.

BUGS:93170


  M +5 -2      ksnapshotwidget.ui.h   1.6


--- kdegraphics/ksnapshot/ksnapshotwidget.ui.h  #1.5:1.6
@@ -32,8 +32,10 @@ void KSnapshotWidget::setPreview( const 
     double r1 = ( ( double ) pm.height() ) / pm.width();
     if ( r1 * previewWidth()  < previewHeight() )
-        img = img.smoothScale(  previewWidth(), int( previewWidth() * r1 ) );
+        img = img.smoothScale(  previewWidth(),
+                                int( previewWidth() * r1 ),
+                                QImage::ScaleMin );
     else
         img = img.smoothScale( ( int ) ( ( ( double )previewHeight() ) / r1 ),
-        previewHeight() );
+                               previewHeight(), QImage::ScaleMin );
 
     QToolTip::remove( lblImage );
@@ -43,4 +45,5 @@ void KSnapshotWidget::setPreview( const 
 
     lblImage->setPixmap( img );
+    lblImage->adjustSize();
 }