00001 /*! @file Qt/ImageQtMainForm.ui.h main window for test-ImageQt */ 00002 00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Qt/ImageQtMainForm.ui.h $ 00004 // $Id: ImageQtMainForm.ui.h 6191 2006-02-01 23:56:12Z rjpeters $ 00005 00006 /**************************************************************************** 00007 ** ui.h extension file, included from the uic-generated form implementation. 00008 ** 00009 ** If you wish to add, delete or rename slots use Qt Designer which will 00010 ** update this file, preserving your code. Create an init() slot in place of 00011 ** a constructor, and a destroy() slot in place of a destructor. 00012 *****************************************************************************/ 00013 00014 void ImageQtMainForm::setImageFile() 00015 { 00016 QString file = QFileDialog::getOpenFileName( QString::null, 00017 "Images (*.pgm *.ppm)", 00018 this, "OpenImageDialog", 00019 "Choose Image" ); 00020 if( !file.isEmpty() ) 00021 ImageFileLineEdit->setText( file ); 00022 loadImage(); 00023 } 00024 00025 00026 void ImageQtMainForm::displayImage() 00027 { 00028 QPixmap qpixm = convertToQPixmap( img ); 00029 if( FullSizeBox->isChecked() ) 00030 { 00031 QDialog imgDialog( this, "ImageDisplay", 1 ); 00032 imgDialog.setCaption( "Full-size Display" ); 00033 imgDialog.setPaletteBackgroundPixmap( qpixm ); 00034 imgDialog.setFixedSize( img.getWidth(), img.getHeight() ); 00035 imgDialog.exec(); 00036 } 00037 else 00038 { 00039 ImagePixmapLabel->setPixmap( qpixm ); 00040 } 00041 } 00042 00043 00044 void ImageQtMainForm::loadImage() 00045 { 00046 QString file = ImageFileLineEdit->text(); 00047 if( !file.isEmpty() ) 00048 img = Raster::ReadRGB( file ); 00049 else 00050 QMessageBox::critical( this, "Error", 00051 "Error: No image file specified!", 00052 QMessageBox::Ok, QMessageBox::NoButton, 00053 QMessageBox::NoButton ); 00054 }