[patch] Fix for ksnapshot preview cropping

Aaron J. Seigo aseigo at kde.org
Sun Feb 6 00:42:49 GMT 2005


On Saturday 05 February 2005 05:03, Brad Hards wrote:
> --- ksnapshotwidget.ui.h        11 Dec 2004 21:40:39 -0000      1.5
> +++ ksnapshotwidget.ui.h        5 Feb 2005 23:52:00 -0000
> @@ -30,19 +30,22 @@ void KSnapshotWidget::setPreview( const
>  {
>      QImage img = pm.convertToImage();
>      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 );
>      QToolTip::add( lblImage,
>          QString( "Preview of the snapshot image (%1 x %2)" )
>          .arg( pm.width() ).arg( pm.height() ) );
>
>      lblImage->setPixmap( img );
> +    lblImage->adjustSize();
>  }

as this change the size of the lblimage, the next snapshot will get SmaleMin'd 
to the new size, correct? and this may change the lblimage size yet again? 
w/out actually testing this, it looks like this may result in an ever 
expanding preview label with continued use? have you tested this?

if this is indeed a problem, perhaps caching the size of the label after it's 
initially shown and and using that as the value for previewHeight() and 
previewWidth()?

-- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050205/d90ebc63/attachment.sig>


More information about the kde-core-devel mailing list