Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4OpenGLQtExportDialog.cc,v 1.9 2008-10-24 14:17:10 lgarnier Exp $ >> 28 // GEANT4 tag $Name: geant4-09-04-patch-02 $ 27 // 29 // 28 // << 30 // >> 31 >> 32 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER 29 33 30 #include "G4OpenGLQtExportDialog.hh" 34 #include "G4OpenGLQtExportDialog.hh" 31 35 32 #include <qvariant.h> 36 #include <qvariant.h> 33 #include <qpushbutton.h> 37 #include <qpushbutton.h> 34 #include <qcheckbox.h> 38 #include <qcheckbox.h> 35 #include <qlabel.h> 39 #include <qlabel.h> 36 #include <qcombobox.h> 40 #include <qcombobox.h> 37 #include <qslider.h> 41 #include <qslider.h> 38 #include <qlayout.h> 42 #include <qlayout.h> 39 #include <qgroupbox.h> 43 #include <qgroupbox.h> 40 #include <qradiobutton.h> 44 #include <qradiobutton.h> 41 #include <qimage.h> 45 #include <qimage.h> 42 #include <qlineedit.h> 46 #include <qlineedit.h> 43 #include <qbuttongroup.h> 47 #include <qbuttongroup.h> 44 48 45 #ifndef G4GMAKE << 46 #include "moc_G4OpenGLQtExportDialog.cpp" << 47 #endif << 48 << 49 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog 49 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog( 50 QWidget* parentw << 50 QWidget* parent 51 ,QString format 51 ,QString format 52 ,int aHeight 52 ,int aHeight 53 ,int aWidth 53 ,int aWidth 54 ) 54 ) 55 : QDialog( parentw ), << 55 : QDialog( parent ), 56 isChangingSize(false) 56 isChangingSize(false) 57 { 57 { >> 58 #if QT_VERSION < 0x040000 >> 59 setCaption( tr( " Export options" )); >> 60 #else 58 setWindowTitle( tr( " Export options" )); 61 setWindowTitle( tr( " Export options" )); >> 62 #endif 59 originalWidth = aWidth; 63 originalWidth = aWidth; 60 originalHeight = aHeight; 64 originalHeight = aHeight; 61 65 62 // Initializations 66 // Initializations 63 vectorEPSCheckBox = NULL; << 64 qualitySlider = NULL; 67 qualitySlider = NULL; 65 width = NULL; 68 width = NULL; 66 height = NULL; 69 height = NULL; 67 colorButton = NULL; 70 colorButton = NULL; 68 BWButton = NULL; 71 BWButton = NULL; 69 72 70 // global layout 73 // global layout 71 QVBoxLayout* globalVLayout = new QVBoxLayout 74 QVBoxLayout* globalVLayout = new QVBoxLayout(this); 72 globalVLayout->setContentsMargins(10,10,10,1 << 75 globalVLayout->setMargin(10); 73 globalVLayout->setSpacing(10); 76 globalVLayout->setSpacing(10); >> 77 >> 78 >> 79 >> 80 // FIXME : L. Garnier 4/12/07 >> 81 // Not implented. Should deal with alpha channel 74 82 >> 83 // if((format == "tif") || >> 84 // (format == "tiff") || >> 85 // (format == "jpg") || >> 86 // (format == "jpeg") || >> 87 // (format == "png") || >> 88 // (format == "xpm")) { 75 89 >> 90 // QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"),this); >> 91 // QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox); >> 92 >> 93 // boxTransparency = new QCheckBox("Save transparency",transparencyGroupBox); >> 94 // boxTransparency->setChecked( false ); >> 95 >> 96 // transparencyGroupBoxLayout->addWidget(boxTransparency); >> 97 // #if QT_VERSION >= 0x040000 >> 98 // transparencyGroupBox->setLayout(transparencyGroupBoxLayout); >> 99 // #endif >> 100 // globalVLayout->addWidget(transparencyGroupBox); >> 101 >> 102 // } >> 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")) { 76 108 77 109 78 // size box 110 // size box 79 111 80 QWidget * sizeWidget = new QWidget(this); // 112 QWidget * sizeWidget = new QWidget(this); // widget containing group button 81 QVBoxLayout * sizeWidgetLayout = new QVBoxLa 113 QVBoxLayout * sizeWidgetLayout = new QVBoxLayout(sizeWidget); 82 sizeWidgetLayout->setContentsMargins(10,10,1 << 114 sizeWidgetLayout->setMargin (10); 83 115 84 // original and modify radiobuttons 116 // original and modify radiobuttons >> 117 #if QT_VERSION < 0x040000 >> 118 QButtonGroup * sizeButtonGroupBox = new QButtonGroup ( 2,Qt::Vertical, tr("Size"),this); >> 119 sizeButtonGroupBox->setInsideMargin (15); >> 120 >> 121 original = new QRadioButton("Original",sizeButtonGroupBox); >> 122 modify = new QRadioButton("Modify",sizeButtonGroupBox); >> 123 >> 124 sizeButtonGroupBox->insert(original); >> 125 sizeButtonGroupBox->insert(modify); >> 126 sizeButtonGroupBox->setExclusive(true); >> 127 sizeWidgetLayout->add(sizeButtonGroupBox); 85 128 >> 129 connect( sizeButtonGroupBox, SIGNAL( clicked(int) ), this, SLOT( changeSizeBox()) ); >> 130 #else >> 131 86 sizeGroupBox = new QGroupBox(tr("Size")); 132 sizeGroupBox = new QGroupBox(tr("Size")); 87 QVBoxLayout *sizeGroupBoxLayout = new QVBoxL 133 QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox); 88 QButtonGroup * sizeButtonGroupBox = new QBut 134 QButtonGroup * sizeButtonGroupBox = new QButtonGroup(); 89 sizeGroupBoxLayout->setContentsMargins(15,15 << 135 sizeGroupBoxLayout->setMargin (15); 90 136 91 original = new QRadioButton("Original"); 137 original = new QRadioButton("Original"); 92 modify = new QRadioButton("Modify"); 138 modify = new QRadioButton("Modify"); 93 139 94 sizeButtonGroupBox->addButton(original); 140 sizeButtonGroupBox->addButton(original); 95 sizeButtonGroupBox->addButton(modify); 141 sizeButtonGroupBox->addButton(modify); 96 sizeButtonGroupBox->setExclusive(true); 142 sizeButtonGroupBox->setExclusive(true); 97 143 98 sizeGroupBoxLayout->addWidget(original); << 144 sizeGroupBoxLayout->addWidget(original); 99 sizeGroupBoxLayout->addWidget(modify); << 145 sizeGroupBoxLayout->addWidget(modify); 100 146 101 sizeGroupBox->setLayout(sizeGroupBoxLayout); 147 sizeGroupBox->setLayout(sizeGroupBoxLayout); 102 sizeWidgetLayout->addWidget(sizeGroupBox); 148 sizeWidgetLayout->addWidget(sizeGroupBox); 103 << 149 104 connect( sizeButtonGroupBox, SIGNAL( buttonC 150 connect( sizeButtonGroupBox, SIGNAL( buttonClicked(QAbstractButton*) ), this, SLOT( changeSizeBox()) ); >> 151 #endif 105 original->setChecked( true ); 152 original->setChecked( true ); 106 153 107 154 108 // height 155 // height 109 heightWidget = new QWidget(sizeWidget); 156 heightWidget = new QWidget(sizeWidget); 110 157 111 QHBoxLayout *heightLineLayout = new QHBoxLay 158 QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget); 112 159 113 QString tmp; 160 QString tmp; 114 << 161 115 heightLineLayout->addWidget(new QLabel("Heig 162 heightLineLayout->addWidget(new QLabel("Height",heightWidget)); 116 height = new QLineEdit(tmp.setNum(originalHe 163 height = new QLineEdit(tmp.setNum(originalHeight),heightWidget); 117 height->setMaxLength(5); 164 height->setMaxLength(5); >> 165 #if QT_VERSION < 0x040000 >> 166 heightLineLayout->add(height); >> 167 #else 118 heightLineLayout->addWidget(height); 168 heightLineLayout->addWidget(height); >> 169 #endif 119 170 >> 171 #if QT_VERSION >= 0x040000 120 heightWidget->setLayout(heightLineLayout); 172 heightWidget->setLayout(heightLineLayout); >> 173 #endif 121 174 >> 175 #if QT_VERSION < 0x040000 >> 176 sizeWidgetLayout->add(heightWidget); >> 177 #else 122 sizeWidgetLayout->addWidget(heightWidget); 178 sizeWidgetLayout->addWidget(heightWidget); >> 179 #endif 123 connect( height, SIGNAL( textChanged ( const 180 connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) ); 124 181 125 182 126 // width 183 // width 127 widthWidget = new QWidget(sizeWidget); 184 widthWidget = new QWidget(sizeWidget); 128 185 129 QHBoxLayout *widthLineLayout = new QHBoxLayo 186 QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget); 130 187 >> 188 #if QT_VERSION < 0x040000 >> 189 widthLineLayout->add(new QLabel("Width ",widthWidget)); >> 190 #else 131 widthLineLayout->addWidget(new QLabel("Width 191 widthLineLayout->addWidget(new QLabel("Width ",widthWidget)); >> 192 #endif 132 width = new QLineEdit(tmp.setNum(originalWid 193 width = new QLineEdit(tmp.setNum(originalWidth),widthWidget); 133 width->setMaxLength(5); 194 width->setMaxLength(5); >> 195 #if QT_VERSION < 0x040000 >> 196 widthLineLayout->add(width); >> 197 #else 134 widthLineLayout->addWidget(width); 198 widthLineLayout->addWidget(width); >> 199 #endif >> 200 #if QT_VERSION >= 0x040000 135 widthWidget->setLayout(widthLineLayout); 201 widthWidget->setLayout(widthLineLayout); >> 202 #endif >> 203 #if QT_VERSION < 0x040000 >> 204 sizeWidgetLayout->add(widthWidget); >> 205 #else 136 sizeWidgetLayout->addWidget(widthWidget); 206 sizeWidgetLayout->addWidget(widthWidget); >> 207 #endif 137 connect( width, SIGNAL( textChanged ( const 208 connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) ); 138 209 139 210 140 211 141 // ratio check box 212 // ratio check box 142 213 143 ratioCheckBox = new QCheckBox( "Keep ratio", 214 ratioCheckBox = new QCheckBox( "Keep ratio",sizeWidget); 144 ratioCheckBox->setChecked( true ); 215 ratioCheckBox->setChecked( true ); 145 216 >> 217 #if QT_VERSION < 0x040000 >> 218 sizeWidgetLayout->add(ratioCheckBox); >> 219 #else 146 sizeWidgetLayout->addWidget(ratioCheckBox); 220 sizeWidgetLayout->addWidget(ratioCheckBox); >> 221 #endif 147 222 >> 223 #if QT_VERSION < 0x040000 >> 224 ratioCheckBox->setEnabled ( false ); >> 225 heightWidget->setEnabled ( false ); >> 226 widthWidget->setEnabled ( false ); >> 227 #else 148 ratioCheckBox->hide(); 228 ratioCheckBox->hide(); 149 heightWidget->hide(); 229 heightWidget->hide(); 150 widthWidget->hide(); 230 widthWidget->hide(); >> 231 #endif 151 232 >> 233 #if QT_VERSION >= 0x040000 152 sizeWidget->setLayout(sizeWidgetLayout); 234 sizeWidget->setLayout(sizeWidgetLayout); >> 235 #endif 153 globalVLayout->addWidget(sizeWidget); 236 globalVLayout->addWidget(sizeWidget); 154 237 155 if (format == "eps") { 238 if (format == "eps") { 156 239 157 QGroupBox *EPSWidgetGroupBox = new QGroupBo 240 QGroupBox *EPSWidgetGroupBox = new QGroupBox(tr("EPS options"),this); // widget containing group button 158 241 159 242 >> 243 #if QT_VERSION < 0x040000 >> 244 >> 245 EPSWidgetGroupBox->setInsideMargin (15); >> 246 >> 247 // QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this); >> 248 // EPSGroupBoxLayout = new QVBoxLayout(EPSColorButtonGroupBox); >> 249 // colorButton = new QRadioButton("Color",EPSColorButtonGroupBox); >> 250 // BWButton = new QRadioButton("Grayscale",EPSColorButtonGroupBox); >> 251 // EPSColorButtonGroupBox->setInsideMargin (15); >> 252 // EPSColorButtonGroupBox->insert(colorButton); >> 253 // EPSColorButtonGroupBox->insert(BWButton); >> 254 // EPSColorButtonGroupBox->setExclusive(true); >> 255 // EPSWidgetGroupBox->add(EPSColorButtonGroupBox); >> 256 >> 257 vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox); >> 258 >> 259 #else 160 QVBoxLayout * EPSGroupBoxLayout = new QVBo 260 QVBoxLayout * EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox); 161 EPSGroupBoxLayout->setContentsMargins(15, << 261 EPSGroupBoxLayout->setMargin (15); 162 262 163 // colorButton = new QRadioButton("Color", 263 // colorButton = new QRadioButton("Color",EPSWidgetGroupBox); 164 // BWButton = new QRadioButton("Grayscale" 264 // BWButton = new QRadioButton("Grayscale",EPSWidgetGroupBox); 165 265 166 // QButtonGroup * EPSColorButtonGroupBox = 266 // QButtonGroup * EPSColorButtonGroupBox = new QButtonGroup(); 167 // EPSColorButtonGroupBox->addButton(color 267 // EPSColorButtonGroupBox->addButton(colorButton); 168 // EPSColorButtonGroupBox->addButton(BWBut 268 // EPSColorButtonGroupBox->addButton(BWButton); 169 // EPSColorButtonGroupBox->setExclusive(tr 269 // EPSColorButtonGroupBox->setExclusive(true); 170 270 171 // EPSGroupBoxLayout->addWidget(colorButto << 271 // EPSGroupBoxLayout->addWidget(colorButton); 172 // EPSGroupBoxLayout->addWidget(BWButton); << 272 // EPSGroupBoxLayout->addWidget(BWButton); 173 273 174 vectorEPSCheckBox = new QCheckBox( "Vector 274 vectorEPSCheckBox = new QCheckBox( "Vector EPS File",EPSWidgetGroupBox); 175 EPSGroupBoxLayout->addWidget(vectorEPSChec 275 EPSGroupBoxLayout->addWidget(vectorEPSCheckBox); 176 276 177 EPSWidgetGroupBox->setLayout(EPSGroupBoxLa 277 EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout); >> 278 #endif 178 // colorButton->setChecked( true ); 279 // colorButton->setChecked( true ); 179 vectorEPSCheckBox->setChecked( true ); 280 vectorEPSCheckBox->setChecked( true ); 180 << 281 181 globalVLayout->addWidget(EPSWidgetGroupBox 282 globalVLayout->addWidget(EPSWidgetGroupBox); 182 connect( vectorEPSCheckBox, SIGNAL( clicke 283 connect( vectorEPSCheckBox, SIGNAL( clicked() ), this, SLOT( changeVectorEPS()) ); 183 284 184 } 285 } 185 286 186 if ((format == "jpg") || << 287 if ((format == "jpg") || 187 (format == "jpeg")) { 288 (format == "jpeg")) { 188 << 289 189 QGroupBox *imageGroupBox = new QGroupBox(t 290 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this); 190 QHBoxLayout *hSliderLayout = new QHBoxLayo 291 QHBoxLayout *hSliderLayout = new QHBoxLayout(imageGroupBox); 191 hSliderLayout->setContentsMargins(15,15,15 << 292 hSliderLayout->setMargin (15); 192 293 193 qualitySlider= new QSlider(Qt::Horizontal, 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 194 qualitySlider->setMinimum(0); 300 qualitySlider->setMinimum(0); 195 qualitySlider->setMaximum(100); 301 qualitySlider->setMaximum(100); 196 qualitySlider->setTickPosition(QSlider::Ti 302 qualitySlider->setTickPosition(QSlider::TicksBelow); >> 303 #endif 197 qualitySlider->setValue(60); 304 qualitySlider->setValue(60); 198 hSliderLayout->addWidget(new QLabel("Low " 305 hSliderLayout->addWidget(new QLabel("Low ",imageGroupBox)); 199 hSliderLayout->addWidget(qualitySlider); 306 hSliderLayout->addWidget(qualitySlider); 200 hSliderLayout->addWidget(new QLabel(" Maxi 307 hSliderLayout->addWidget(new QLabel(" Maximum",imageGroupBox)); 201 << 308 >> 309 #if QT_VERSION >= 0x040000 202 imageGroupBox->setLayout(hSliderLayout); 310 imageGroupBox->setLayout(hSliderLayout); >> 311 #endif 203 312 204 globalVLayout->addWidget(imageGroupBox); 313 globalVLayout->addWidget(imageGroupBox); 205 } 314 } 206 315 207 316 208 // button ok/cancel box 317 // button ok/cancel box 209 318 210 QWidget *buttonBox = new QWidget(this); 319 QWidget *buttonBox = new QWidget(this); 211 320 212 QHBoxLayout *buttonBoxLayout = new QHBoxLayo 321 QHBoxLayout *buttonBoxLayout = new QHBoxLayout(buttonBox); 213 322 214 buttonOk = new QPushButton( tr( "&OK" ),butt 323 buttonOk = new QPushButton( tr( "&OK" ),buttonBox ); 215 buttonOk->setAutoDefault( true ); << 324 buttonOk->setAutoDefault( TRUE ); 216 buttonOk->setDefault( true ); << 325 buttonOk->setDefault( TRUE ); 217 buttonBoxLayout->addWidget(buttonOk); 326 buttonBoxLayout->addWidget(buttonOk); 218 327 219 buttonCancel = new QPushButton( tr( "&Cancel 328 buttonCancel = new QPushButton( tr( "&Cancel" ),buttonBox ); 220 buttonCancel->setAutoDefault( true ); << 329 buttonCancel->setAutoDefault( TRUE ); 221 buttonBoxLayout->addWidget(buttonCancel); 330 buttonBoxLayout->addWidget(buttonCancel); 222 331 >> 332 #if QT_VERSION >= 0x040000 223 buttonBox->setLayout(buttonBoxLayout); 333 buttonBox->setLayout(buttonBoxLayout); >> 334 #endif 224 globalVLayout->addWidget(buttonBox); 335 globalVLayout->addWidget(buttonBox); 225 336 226 337 227 338 >> 339 #if QT_VERSION >= 0x040000 228 setLayout(globalVLayout); 340 setLayout(globalVLayout); >> 341 #endif 229 342 230 // signals and slots connections 343 // signals and slots connections 231 connect( buttonOk, SIGNAL( clicked() ), this 344 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); 232 connect( buttonCancel, SIGNAL( clicked() ), 345 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 233 } 346 } 234 347 235 348 236 349 237 int G4OpenGLQtExportDialog::getSliderValue() 350 int G4OpenGLQtExportDialog::getSliderValue() 238 { 351 { 239 if (!qualitySlider) return -1; 352 if (!qualitySlider) return -1; 240 return qualitySlider->value(); 353 return qualitySlider->value(); 241 } 354 } 242 355 243 int G4OpenGLQtExportDialog::getHeight() 356 int G4OpenGLQtExportDialog::getHeight() 244 { 357 { 245 if (!height) return originalHeight; 358 if (!height) return originalHeight; 246 return height->text().toInt(); 359 return height->text().toInt(); 247 } 360 } 248 361 249 int G4OpenGLQtExportDialog::getWidth() 362 int G4OpenGLQtExportDialog::getWidth() 250 { 363 { 251 if (!width) return originalWidth; 364 if (!width) return originalWidth; 252 return width->text().toInt(); 365 return width->text().toInt(); 253 } 366 } 254 367 >> 368 int G4OpenGLQtExportDialog::getTransparency() >> 369 { >> 370 if (!boxTransparency) return -1; >> 371 return boxTransparency->isChecked(); >> 372 } >> 373 >> 374 int G4OpenGLQtExportDialog::getNbColor() >> 375 { >> 376 if (!colorButton) return -1; >> 377 // Black and white >> 378 if (!colorButton->isChecked()) >> 379 return 1; >> 380 // rgb color >> 381 return 3; >> 382 } >> 383 255 bool G4OpenGLQtExportDialog::getVectorEPS() 384 bool G4OpenGLQtExportDialog::getVectorEPS() 256 { 385 { 257 if (!vectorEPSCheckBox) return 0; 386 if (!vectorEPSCheckBox) return 0; 258 return vectorEPSCheckBox->isChecked(); 387 return vectorEPSCheckBox->isChecked(); 259 } 388 } 260 389 261 390 262 void G4OpenGLQtExportDialog::changeVectorEPS() 391 void G4OpenGLQtExportDialog::changeVectorEPS() 263 { 392 { 264 if (!vectorEPSCheckBox) return; 393 if (!vectorEPSCheckBox) return; 265 if (vectorEPSCheckBox->isChecked()) { 394 if (vectorEPSCheckBox->isChecked()) { >> 395 #if QT_VERSION < 0x040000 >> 396 original->setEnabled ( true ); >> 397 modify->setEnabled ( true ); >> 398 #else 266 sizeGroupBox->show(); 399 sizeGroupBox->show(); 267 original->show(); 400 original->show(); 268 modify->show(); 401 modify->show(); >> 402 #endif 269 changeSizeBox(); 403 changeSizeBox(); 270 } else { 404 } else { >> 405 #if QT_VERSION < 0x040000 >> 406 original->setEnabled ( false ); >> 407 modify->setEnabled ( false ); >> 408 ratioCheckBox->setEnabled ( false ); >> 409 heightWidget->setEnabled ( false ); >> 410 widthWidget->setEnabled ( false ); >> 411 #else 271 sizeGroupBox->hide(); 412 sizeGroupBox->hide(); 272 original->hide(); 413 original->hide(); 273 modify->hide(); 414 modify->hide(); 274 ratioCheckBox->hide(); 415 ratioCheckBox->hide(); 275 heightWidget->hide(); 416 heightWidget->hide(); 276 widthWidget->hide(); 417 widthWidget->hide(); >> 418 #endif 277 } 419 } 278 } 420 } 279 421 280 422 281 void G4OpenGLQtExportDialog::changeSizeBox() 423 void G4OpenGLQtExportDialog::changeSizeBox() 282 { 424 { 283 if (!original) return; 425 if (!original) return; 284 if (!heightWidget) return; 426 if (!heightWidget) return; 285 if (!widthWidget) return; 427 if (!widthWidget) return; 286 if (!ratioCheckBox) return; 428 if (!ratioCheckBox) return; 287 429 288 if ( original->isChecked()) { 430 if ( original->isChecked()) { >> 431 #if QT_VERSION < 0x040000 >> 432 ratioCheckBox->setEnabled ( false ); >> 433 heightWidget->setEnabled ( false ); >> 434 widthWidget->setEnabled ( false ); >> 435 #else 289 ratioCheckBox->hide(); 436 ratioCheckBox->hide(); 290 heightWidget->hide(); 437 heightWidget->hide(); 291 widthWidget->hide(); 438 widthWidget->hide(); >> 439 #endif 292 } else { 440 } else { >> 441 #if QT_VERSION < 0x040000 >> 442 ratioCheckBox->setEnabled ( true ); >> 443 heightWidget->setEnabled ( true ); >> 444 widthWidget->setEnabled ( true ); >> 445 #else 293 heightWidget->show(); 446 heightWidget->show(); 294 widthWidget->show(); 447 widthWidget->show(); 295 ratioCheckBox->show(); 448 ratioCheckBox->show(); >> 449 #endif 296 } 450 } 297 } 451 } 298 452 299 453 300 void G4OpenGLQtExportDialog::textWidthChanged( 454 void G4OpenGLQtExportDialog::textWidthChanged( 301 const QString & s 455 const QString & s 302 ) 456 ) 303 { 457 { 304 if (!ratioCheckBox) return; 458 if (!ratioCheckBox) return; 305 if (!width) return; 459 if (!width) return; 306 if (isChangingSize == true) return; // exclu 460 if (isChangingSize == true) return; // exclusive slot 307 461 308 if (ratioCheckBox->isChecked()){ 462 if (ratioCheckBox->isChecked()){ 309 isChangingSize = true; 463 isChangingSize = true; 310 QString tmp; 464 QString tmp; 311 height->setText(tmp.setNum((int)(s.toInt()*( 465 height->setText(tmp.setNum((int)(s.toInt()*(double)((double)originalHeight/(double)originalWidth)))); 312 isChangingSize = false; 466 isChangingSize = false; 313 } 467 } 314 } 468 } 315 469 316 void G4OpenGLQtExportDialog:: textHeightChang 470 void G4OpenGLQtExportDialog:: textHeightChanged( 317 const QString & s 471 const QString & s 318 ) 472 ) 319 { 473 { 320 if (!ratioCheckBox) return; 474 if (!ratioCheckBox) return; 321 if (!width) return; 475 if (!width) return; 322 if (isChangingSize == true) return; // exclu 476 if (isChangingSize == true) return; // exclusive slot 323 477 324 if (ratioCheckBox->isChecked()){ 478 if (ratioCheckBox->isChecked()){ 325 isChangingSize = true; 479 isChangingSize = true; 326 QString tmp; 480 QString tmp; 327 width->setText(tmp.setNum(s.toInt()*origin 481 width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight)); 328 isChangingSize = false; 482 isChangingSize = false; 329 } 483 } 330 } << 484 } 331 485 332 G4OpenGLQtExportDialog::~G4OpenGLQtExportDialo 486 G4OpenGLQtExportDialog::~G4OpenGLQtExportDialog() 333 { 487 { 334 } 488 } >> 489 >> 490 >> 491 #endif 335 492