Changeset 656 for trunk/geant4
- Timestamp:
- Dec 11, 2007, 5:25:54 PM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
r652 r656 47 47 48 48 /** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options 49 for each file format50 49 for each file format 50 */ 51 51 class G4OpenGLQtExportDialog : public QDialog 52 52 { 53 53 Q_OBJECT 54 54 55 public:55 public: 56 56 /** Construct a G4OpenGLQtExportDialog 57 57 @param parent : parent widget 58 @param name : name of the saved file with extention59 58 @param format : format of save file in lower case 60 59 @param height : height of the original file 61 60 @param width : width of the original file 62 61 */ 63 G4OpenGLQtExportDialog(QWidget* parent, QString name, QStringformat, int height =0, int width=0);62 G4OpenGLQtExportDialog(QWidget* parent, QString format, int height =0, int width=0); 64 63 65 64 /** Destroys G4OpenGLQtExportDialog */ … … 70 69 71 70 /** return the new width for file if format has a width widget, instead return 72 the original value */71 the original value */ 73 72 int getWidth(); 74 73 75 74 /** return the new height for file if format has a height widget, instead return 76 the original value */75 the original value */ 77 76 int getHeight(); 78 77 … … 86 85 bool getVectorEPS(); 87 86 88 public slots:87 public slots: 89 88 90 /** Called by a clic on modify/original size button.This will 91 invert buttons and hide/unhide size 92 */ 93 void changeSizeBox(); 89 /** Called by a clic on modify/original size button.This will 90 invert buttons and hide/unhide size 91 */ 92 void changeSizeBox(); 93 94 /** Called by a clic on vectorEPS check box.If vectorEPS checkBox is checked, 95 it will enable change size buttons. Else it will disable them. 96 */ 97 void changeVectorEPS(); 94 98 95 99 /** Called by changing value in height lineEdit. If ratio is keep, will also change the width … … 101 105 void textHeightChanged(const QString &); 102 106 103 private:107 private: 104 108 QString f_name, f_type, f_dir; 105 109 QLabel* qualityLabel; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r652 r656 132 132 void toggleAux(bool); 133 133 void toggleFullScreen(bool); 134 #if QT_VERSION >= 0x040000134 // Only use for Qt>4.0 135 135 void dialogClosed(); 136 #endif137 136 }; 138 137 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
r655 r656 50 50 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog( 51 51 QWidget* parent 52 ,QString nomFich53 52 ,QString format 54 53 ,int aHeight … … 103 102 // } 104 103 104 // FIXME : L. Garnier 4/12/07 105 // This is not working for PS and PDF images, it does nothing. 106 // Image is staying in color mode 107 // if ((format == "ps") || (format == "pdf") || (format == "eps")) { 108 109 105 110 // size box 106 111 … … 231 236 globalVLayout->addWidget(sizeWidget); 232 237 233 if ((format == "jpg") ||234 (format == "jpeg")) {235 236 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this);237 QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox);238 hSliderLayout->setMargin (15);239 240 qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox);241 #if QT_VERSION < 0x040000242 qualitySlider->setMinValue(0);243 qualitySlider->setMaxValue(100);244 qualitySlider->setTickmarks(QSlider::Below);245 #else246 qualitySlider->setMinimum(0);247 qualitySlider->setMaximum(100);248 qualitySlider->setTickPosition(QSlider::TicksBelow);249 #endif250 qualitySlider->setValue(60);251 hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox));252 hSliderLayout->addWidget(qualitySlider);253 hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox));254 255 #if QT_VERSION >= 0x040000256 imageGroupBox->setLayout(hSliderLayout);257 #endif258 259 #if QT_VERSION >= 0x040000260 imageGroupBox->setLayout(hSliderLayout);261 #endif262 263 globalVLayout->addWidget(imageGroupBox);264 }265 266 267 // FIXME : L. Garnier 4/12/07268 // This is not working for PS and PDF images, it does nothing.269 // Image is staying in color mode270 // if ((format == "ps") || (format == "pdf") || (format == "eps")) {271 272 238 if (format == "eps") { 273 239 274 QWidget * EPSWidgetGroupBox; // widget containing group button 275 QVBoxLayout *EPSGroupBoxLayout; 276 277 #if QT_VERSION < 0x040000 240 QGroupBox *EPSWidgetGroupBox = new QGroupBox(tr("EPS options"),this); // widget containing group button 241 242 243 #if QT_VERSION < 0x040000 244 245 EPSWidgetGroupBox->setInsideMargin (15); 278 246 279 247 // QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this); … … 288 256 289 257 vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox); 290 EPSWidgetGroupBox->add(vectorEPSCheckBox); 291 292 #else 293 EPSWidgetGroupBox = new QGroupBox(tr("EPS options")); 294 // EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox); 295 // EPSGroupBoxLayout->setMargin (15); 258 259 #else 260 QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox); 261 EPSGroupBoxLayout->setMargin (15); 296 262 297 263 // colorButton = new QRadioButton("Color",EPSWidgetGroupBox); … … 315 281 316 282 globalVLayout->addWidget(EPSWidgetGroupBox); 317 283 connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) ); 284 285 } 286 287 if ((format == "jpg") || 288 (format == "jpeg")) { 289 290 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this); 291 QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox); 292 hSliderLayout->setMargin (15); 293 294 qualitySlider= new QSlider(Qt::Horizontal,imageGroupBox); 295 #if QT_VERSION < 0x040000 296 qualitySlider->setMinValue(0); 297 qualitySlider->setMaxValue(100); 298 qualitySlider->setTickmarks(QSlider::Below); 299 #else 300 qualitySlider->setMinimum(0); 301 qualitySlider->setMaximum(100); 302 qualitySlider->setTickPosition(QSlider::TicksBelow); 303 #endif 304 qualitySlider->setValue(60); 305 hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox)); 306 hSliderLayout->addWidget(qualitySlider); 307 hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox)); 308 309 #if QT_VERSION >= 0x040000 310 imageGroupBox->setLayout(hSliderLayout); 311 #endif 312 313 #if QT_VERSION >= 0x040000 314 imageGroupBox->setLayout(hSliderLayout); 315 #endif 316 317 globalVLayout->addWidget(imageGroupBox); 318 318 } 319 319 … … 393 393 394 394 395 void G4OpenGLQtExportDialog::changeVectorEPS() 396 { 397 if (!vectorEPSCheckBox) return; 398 if (vectorEPSCheckBox->isChecked()) { 399 #if QT_VERSION < 0x040000 400 original->setEnabled ( true ); 401 modify->setEnabled ( true ); 402 #else 403 original->show(); 404 modify->show(); 405 #endif 406 changeSizeBox(); 407 } else { 408 #if QT_VERSION < 0x040000 409 original->setEnabled ( false ); 410 modify->setEnabled ( false ); 411 ratioCheckBox->setEnabled ( false ); 412 heightWidget->setEnabled ( false ); 413 widthWidget->setEnabled ( false ); 414 #else 415 original->hide(); 416 modify->hide(); 417 ratioCheckBox->hide(); 418 heightWidget->hide(); 419 widthWidget->hide(); 420 #endif 421 } 422 } 423 424 395 425 void G4OpenGLQtExportDialog::changeSizeBox() 396 426 { … … 432 462 if (ratioCheckBox->isChecked()){ 433 463 QString tmp; 434 width->setText(tmp.setNum(s.toInt()*originalHeight/originalHeight));464 height->setText(tmp.setNum(s.toInt()*originalHeight/originalWidth)); 435 465 } 436 466 } … … 445 475 if (ratioCheckBox->isChecked()){ 446 476 QString tmp; 447 width->setText(tmp.setNum(s.toInt()*originalWidth/original Width));477 width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight)); 448 478 } 449 479 } -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r655 r656 1087 1087 QString format = selectedFormat->toLower(); 1088 1088 #endif 1089 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow, nomFich,format,fWindow->height(),fWindow->width());1089 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,format,fWindow->height(),fWindow->width()); 1090 1090 if( exportDialog->exec()) { 1091 1091 … … 1151 1151 } else { 1152 1152 #if QT_VERSION < 0x040000 1153 G4c err << "File "<<nomFich.ascii()<<"saved \n" << G4endl;1154 #else 1155 G4c err << "File "<<nomFich.toStdString().c_str()<<"saved \n" << G4endl;1153 G4cout << "File "<<nomFich.ascii()<<" has been saved \n" << G4endl; 1154 #else 1155 G4cout << "File "<<nomFich.toStdString().c_str()<<" has been saved \n" << G4endl; 1156 1156 #endif 1157 1157 } … … 1326 1326 glRenderMode (GL_FEEDBACK); 1327 1327 1328 #ifdef GEANT4_QT_DEBUG1329 printf("generateVectorEPS:: AVANt DRAWVIEW !!======================== \n");1330 #endif1331 1328 glViewport (0, 0, aWidth,aHeight); 1332 1329 DrawView(); 1333 1330 1334 #ifdef GEANT4_QT_DEBUG1335 printf("generateVectorEPS:: APREs DRAWVIEW !!======================== \n");1336 #endif1337 1331 returned = glRenderMode (GL_RENDER); 1338 1332
Note: See TracChangeset
for help on using the changeset viewer.