[Kstars-devel] branches/kstars/summer/kstars/kstars/tools

Prakash Mohan prak902000 at gmail.com
Sat Jun 27 23:28:30 CEST 2009


SVN commit 988355 by prakash:

Getting rid of the "Show in Imageviewer" button by using an eventFilter.

CCMAIL: kstars-devel at kde.org


 M  +6 -8      observinglist.cpp  
 M  +2 -0      observinglist.h  
 M  +0 -13     observinglist.ui  


--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #988354:988355
@@ -125,6 +125,7 @@
     ui->View->axis(KPlotWidget::TopAxis)->setTickLabelsShown( true );
     ui->DateEdit->setDate(dt.date());
     ui->SetLocation->setText( geo -> fullName() );
+    ui->ImagePreview->installEventFilter( this );
     //Connections
     connect( this, SIGNAL( closeClicked() ), this, SLOT( slotClose() ) );
     connect( ui->TableView, SIGNAL( doubleClicked( const QModelIndex& ) ),
@@ -170,8 +171,6 @@
              this, SLOT( slotUpdate() ) );
     connect( ui->GetImage, SIGNAL( clicked() ),
              this, SLOT( slotGetImage() ) );
-    connect( ui->ExpandImage, SIGNAL( clicked() ),
-             this, SLOT( slotImageViewer() ) );
     connect( ui->SetTime, SIGNAL( clicked() ),
              this, SLOT( slotSetTime() ) );
     connect( ui->tabWidget, SIGNAL( currentChanged(int) ),
@@ -199,7 +198,6 @@
     ui->TimeEdit->setEnabled( false );
     ui->GetImage->setEnabled( false );
     ui->saveImages->setEnabled( false );
-    ui->ExpandImage->hide();
 
     slotLoadWishList(); //Load the wishlist from disk if present
     setSaveImages();
@@ -375,7 +373,6 @@
 }
 
 void ObservingList::slotRemoveSelectedObjects() {
-    ui->ExpandImage->hide();
     if( sessionView )
     {
         //Find each object by name in the session list, and remove it
@@ -437,7 +434,6 @@
 
 void ObservingList::slotNewSelection() {
     bool singleSelection = false, found = false;
-    ui->ExpandImage->hide();
     ui->ImagePreview->clearPreview();
     ui->ImagePreview->hide();
     QModelIndexList selectedItems;
@@ -524,7 +520,6 @@
             if( QFile::exists( KStandardDirs::locateLocal( "appdata", CurrentImage ) ) ) {//If the image is present, show it!
                 ui->ImagePreview->showPreview( KUrl( KStandardDirs::locateLocal( "appdata", CurrentImage ) ));
                 ui->ImagePreview->show();
-                ui->ExpandImage->show();
             }
 
         } else {
@@ -1176,7 +1171,6 @@
     dss = _dss;
     ui->GetImage->setEnabled( false );
     ui->ImagePreview->clearPreview();
-    ui->ExpandImage->hide();
     if( ! QFile::exists( KStandardDirs::locateLocal( "appdata", CurrentImage ) ) ) 
         setCurrentImage( currentObject(), true );
     QFile::remove( KStandardDirs::locateLocal( "appdata", CurrentImage ) );
@@ -1197,7 +1191,6 @@
         ui->GetImage->setEnabled( true );
         ui->ImagePreview->showPreview( KUrl( KStandardDirs::locateLocal( "appdata", CurrentImage ) ) );
         ui->ImagePreview->show();
-        ui->ExpandImage->show();
         if( CurrentImage.contains( "Temp" ) )
             ImageList.append( CurrentImage );
     } 
@@ -1298,4 +1291,9 @@
     }
 }
 
+bool ObservingList::eventFilter( QObject *obj, QEvent *event ) {
+    if( obj == ui->ImagePreview )
+        if( event->type() == QEvent::MouseButtonRelease )
+            slotImageViewer();
+}
 #include "observinglist.moc"
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #988354:988355
@@ -152,6 +152,8 @@
         */
     void saveImage( KUrl url, QString filename );
 
+    bool eventFilter( QObject *obj, QEvent *event );
+
 public slots:
     /**@short add a new object to list
         *@p o pointer to the object to add to the list
--- branches/kstars/summer/kstars/kstars/tools/observinglist.ui #988354:988355
@@ -629,19 +629,6 @@
       </widget>
      </item>
      <item>
-      <widget class="QPushButton" name="ExpandImage">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="text">
-        <string>Show in ImageViewer</string>
-       </property>
-      </widget>
-     </item>
-     <item>
       <spacer name="horizontalSpacer">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>


More information about the Kstars-devel mailing list