[Kstars-devel] branches/kstars/unfrozen/kstars/kstars

Jason Harris kstars at 30doradus.org
Tue Jul 8 07:43:13 CEST 2008


SVN commit 829315 by harris:

Fixing bug #166002 (Option to save DSS image).

The ImageViewer dialog has Save and Close buttons, but due to a layout problem, 
they were not visible in the window.  I added a QFrame container for the image 
canvas and the text caption, and made this container the dialog's mainWidget.  
This makes the dialog buttons visible again.  

Unfortunately, it also causes a pretty thick margin to be added around the 
image/caption.  Maybe a designer file for the dialog could solve this issue, but 
at least the Save button is accessible again.  Too bad it's too late for 4.1...

Thank you very much for the report Prakash!

BUG: 166002
CCMAIL: kstars-devel at kde.org



 M  +9 -4      imageviewer.cpp  
 M  +2 -6      imageviewer.h  


--- branches/kstars/unfrozen/kstars/kstars/imageviewer.cpp #829314:829315
@@ -19,14 +19,16 @@
 #include "kstars.h"
 
 #include <QFont>
+#include <QPainter>
 #include <QResizeEvent>
 #include <QKeyEvent>
-#include <QPainter>
 #include <QPaintEvent>
 #include <QCloseEvent>
 #include <QDesktopWidget>
 #include <QVBoxLayout>
 #include <QApplication>
+#include <QLabel>
+#include <QVBoxLayout>
 
 #include <klocale.h>
 #include <kmessagebox.h>
@@ -70,8 +72,10 @@
     KGuiItem saveButton( i18n("Save"), "document-save", i18n("Save the image to disk") );
     setButtonGuiItem( KDialog::User1, saveButton );
 
-    View = new ImageLabel( this );
-    Caption = new QLabel( this );
+    Page = new QFrame( this );
+    setMainWidget( Page );
+    View = new ImageLabel( Page );
+    Caption = new QLabel( Page );
     View->setAutoFillBackground( true );
     Caption->setAutoFillBackground( true );
     Caption->setFrameShape( QFrame::StyledPanel );
@@ -88,7 +92,7 @@
     capFont.setPointSize( capFont.pointSize() - 2 );
     Caption->setFont( capFont );
 
-    vlay = new QVBoxLayout( this );
+    vlay = new QVBoxLayout( Page );
     vlay->setSpacing( 0 );
     vlay->setMargin( 0 );
     vlay->addWidget( View );
@@ -115,6 +119,7 @@
 
     delete View;
     delete Caption;
+    delete Page;
     if ( downloadJob ) delete downloadJob;
 }
 
--- branches/kstars/unfrozen/kstars/kstars/imageviewer.h #829314:829315
@@ -18,15 +18,10 @@
 #ifndef IMAGEVIEWER_H_
 #define IMAGEVIEWER_H_
 
+#include <QFrame>
 #include <QFile>
-#include <QLabel>
-#include <QVBoxLayout>
 #include <QImage>
 #include <QPixmap>
-#include <QResizeEvent>
-#include <QKeyEvent>
-#include <QPaintEvent>
-#include <QCloseEvent>
 
 #include <kio/job.h>
 #include <kdialog.h>
@@ -112,6 +107,7 @@
 
     KIO::Job *downloadJob;  // download job of image -> 0 == no job is running
 
+    QFrame *Page;
     ImageLabel *View;
     QLabel *Caption;
     QVBoxLayout *vlay;


More information about the Kstars-devel mailing list