Bug 104895 - Screenshots are not rescaled when resizing window
Summary: Screenshots are not rescaled when resizing window
Status: RESOLVED FIXED
Alias: None
Product: ksnapshot
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Richard Moore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-01 09:39 UTC by Karl Ove Hufthammer
Modified: 2005-05-07 13:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for this bug (1.60 KB, patch)
2005-05-07 11:51 UTC, Isaac Clerencia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Ove Hufthammer 2005-05-01 09:39:56 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

When resizing (enlarging) the KSnapshow window, the screenshot thumbnail is not rescaled to fit the  available space. It should.

Also, the lower panel (the area over the horizontal line) is resized vertically. It should not, since it doesn't contain any text to fill the added vertical space. Only the upper panel should be resized.
Comment 1 Isaac Clerencia 2005-05-01 17:32:11 UTC
> Also, the lower panel (the area over the horizontal line) is resized 
> vertically. It should not, since it doesn't contain any text to fill the
> added vertical space. Only the upper panel should be resized. 
I agree, removing the widget named "spacer3" from ksnapshot/ksnapshotwidget.ui fixes it, leaving more space for the snapshot preview.
Comment 2 Isaac Clerencia 2005-05-07 11:51:34 UTC
Created attachment 10926 [details]
Patch for this bug

This patch should "fix" this bug. As it is my first patch I should be carefully
reviewed, I'm not sure if this is the best way to do it or even if I'm breaking
anything else, but it's working here against latest SVN :)

Best regards
Comment 3 Stephan Binner 2005-05-07 13:41:50 UTC
SVN commit 410274 by binner:

Rescale screenshot preview when resizing window
Patch by Isaac Clerencia <isaac@sindominio.net>
BUG: 104895


 M  +9 -0      branches/KDE/3.4/kdegraphics/ksnapshot/ksnapshot.cpp  
 M  +3 -1      branches/KDE/3.4/kdegraphics/ksnapshot/ksnapshot.h  


--- branches/KDE/3.4/kdegraphics/ksnapshot/ksnapshot.cpp #410273:410274
@@ -114,6 +114,7 @@
     }
 
     connect( &grabTimer, SIGNAL( timeout() ), this, SLOT(  grabTimerDone() ) );
+    connect( &updateTimer, SIGNAL( timeout() ), this, SLOT(  updatePreview() ) );
     QTimer::singleShot( 0, this, SLOT( updateCaption() ) );
 
     KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);
@@ -151,6 +152,14 @@
 {
 }
 
+void KSnapshot::resizeEvent( QResizeEvent *event)
+{
+	if( !updateTimer.isActive() )
+		updateTimer.start(200, true);
+	else	
+		updateTimer.changeInterval(200);
+}
+
 bool KSnapshot::save( const QString &filename )
 {
     return save( KURL::fromPathOrURL( filename ));
--- branches/KDE/3.4/kdegraphics/ksnapshot/ksnapshot.h #410273:410274
@@ -85,17 +85,18 @@
     void reject() { close(); }
 
     virtual void closeEvent( QCloseEvent * e );
+    void resizeEvent(QResizeEvent*);
     bool eventFilter( QObject*, QEvent* );
     
 private slots:
     void grabTimerDone();
     void slotDragSnapshot();
     void updateCaption();
+    void updatePreview();
     void slotRegionGrabbed( const QPixmap & );
 
 private:
     bool save( const KURL& url );
-    void updatePreview();
     void performGrab();
     void autoincFilename();
     int grabMode();
@@ -103,6 +104,7 @@
 
     QPixmap snapshot;
     QTimer grabTimer;
+    QTimer updateTimer;
     QWidget* grabber;
     KURL filename;
     KSnapshotWidget *mainWidget;