Changeset 633 for trunk/geant4/visualization
- Timestamp:
- Dec 3, 2007, 6:16:19 PM (17 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
r600 r633 85 85 invert buttons and hide/unhide size 86 86 */ 87 void changeSizeBox( bool);87 void changeSizeBox(); 88 88 89 89 /** Called by changing value in height lineEdit. If ratio is keep, will also change the width -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
r606 r633 30 30 // 31 31 32 #define GEANT4_QT_DEBUG 32 33 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER 33 34 … … 45 46 #include <qimage.h> 46 47 #include <qlineedit.h> 48 #include <qbuttongroup.h> 47 49 48 50 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog( … … 70 72 71 73 // global layout 72 #if QT_VERSION < 0x04000073 74 QVBoxLayout* globalVLayout = new QVBoxLayout(this); 74 #else75 QVBoxLayout* globalVLayout = new QVBoxLayout();76 #endif77 75 78 76 … … 80 78 nomFich.endsWith(".jepg")) { 81 79 82 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality")); 83 #if QT_VERSION < 0x040000 80 QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"),this); 84 81 QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout(imageGroupBox); 85 #else86 QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout;87 #endif88 82 QWidget *sliderBox = new QWidget; 89 83 90 #if QT_VERSION < 0x04000091 84 QHBoxLayout *hSlider = new QHBoxLayout(sliderBox); 92 #else93 QHBoxLayout *hSlider = new QHBoxLayout;94 #endif95 85 96 86 // qualityLabel = new QLabel( tr( "Image quality" ) ); 97 87 // imageGroupBoxLayout->addWidget(qualityLabel); 98 qualitySlider= new QSlider(Qt::Horizontal, 0);88 qualitySlider= new QSlider(Qt::Horizontal,this); 99 89 #if QT_VERSION < 0x040000 100 90 qualitySlider->setMinValue(0); … … 107 97 #endif 108 98 qualitySlider->setValue(60); 109 hSlider->addWidget(new QLabel("low", 0));99 hSlider->addWidget(new QLabel("low",this)); 110 100 hSlider->addWidget(qualitySlider); 111 hSlider->addWidget(new QLabel("Maximum", 0));101 hSlider->addWidget(new QLabel("Maximum",this)); 112 102 #if QT_VERSION >= 0x040000 113 103 sliderBox->setLayout(hSlider); … … 122 112 123 113 if(nomFich.endsWith(".eps")) { 124 QGroupBox *EPSGroupBox = new QGroupBox(tr("EPS options"));125 126 #if QT_VERSION < 0x040000127 QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout(EPSGroupBox);128 #else129 QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout;130 #endif131 114 132 115 // transparencyEPS = new QCheckBox( "transparencyEPS" ); … … 134 117 // transparencyEPS->setChecked( true ); 135 118 136 colorButton = new QRadioButton("Color",0); 137 BWButton = new QRadioButton("Grayscale",0); 119 colorButton = new QRadioButton("Color",this); 120 BWButton = new QRadioButton("Grayscale",this); 121 122 QWidget * EPSWidgetGroupBox; // widget containing group button 123 QButtonGroup * EPSButtonGroupBox; // group button 124 #if QT_VERSION < 0x040000 125 EPSButtonGroupBox = new QButtonGroup( 2,Qt::Vertical, tr("EPS options"),this); 126 EPSButtonGroupBox->insert(colorButton); 127 EPSButtonGroupBox->insert(BWButton); 128 EPSButtonGroupBox->setExclusive(true); 138 129 colorButton->setChecked( true ); 139 BWButton->setChecked( false ); 140 141 142 // EPSGroupBoxLayout->addWidget(transparencyEPS); 130 EPSWidgetGroupBox = EPSButtonGroupBox; 131 132 #else 133 EPSWidgetGroupBox = new QGroupBox(tr("EPS options")); 134 QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout(EPSWidgetGroupBox); 135 EPSButtonGroupBox = new QButtonGroup(); 136 colorButton->setChecked( true ); 137 EPSButtonGroupBox->addButton(colorButton); 138 EPSButtonGroupBox->addButton(BWButton); 139 EPSButtonGroupBox->setExclusive(true); 140 143 141 EPSGroupBoxLayout->addWidget(colorButton); 144 142 EPSGroupBoxLayout->addWidget(BWButton); 145 #if QT_VERSION >= 0x040000 146 EPSGroupBox->setLayout(EPSGroupBoxLayout); 147 #endif 148 globalVLayout->addWidget(EPSGroupBox); 143 EPSWidgetGroupBox->setLayout(EPSGroupBoxLayout); 144 145 #endif 146 147 // EPSGroupBoxLayout->addWidget(transparencyEPS); 148 globalVLayout->addWidget(EPSWidgetGroupBox); 149 149 150 150 } … … 156 156 nomFich.endsWith(".xpm")) { 157 157 158 QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency")); 159 #if QT_VERSION < 0x040000 158 QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"),this); 160 159 QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox); 161 #else 162 QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout; 163 #endif 164 165 boxTransparency = new QCheckBox("Save transparency",0); 160 161 boxTransparency = new QCheckBox("Save transparency",this); 166 162 boxTransparency->setChecked( false ); 167 163 // boxTransparency->setEnabled(false); … … 176 172 177 173 // size box 178 QGroupBox *sizeGroupBox = new QGroupBox(tr("Size"));179 174 QWidget* modifyAndRatioWidget = new QWidget; 180 175 181 #if QT_VERSION < 0x040000182 176 QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout(modifyAndRatioWidget); 183 QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);184 #else185 QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout;186 QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout;187 #endif188 177 189 178 // original button 190 original = new QRadioButton("Original",0); 179 original = new QRadioButton("Original",this); 180 // modify and ratio 181 modify = new QRadioButton("Modify",this); 182 183 QWidget * sizeWidgetGroupBox; // widget containing group button 184 QButtonGroup * sizeButtonGroupBox; // group button 185 QLayout *sizeGroupBoxLayout; 186 #if QT_VERSION < 0x040000 187 sizeButtonGroupBox = new QButtonGroup ( 2,Qt::Vertical, tr("Size"),this); 188 189 original = new QRadioButton("Original",sizeButtonGroupBox); 190 modify = new QRadioButton("Modify",sizeButtonGroupBox); 191 192 sizeButtonGroupBox->insert(original); 193 sizeButtonGroupBox->insert(modify); 194 sizeButtonGroupBox->setExclusive(true); 191 195 original->setChecked( true ); 192 sizeGroupBoxLayout->addWidget(original); 193 194 // modify and ratio 195 modify = new QRadioButton("Modify",0); 196 modify->setChecked( false ); 197 198 ratioCheckBox = new QCheckBox( "Keep ratio",0 ); 196 sizeWidgetGroupBox = sizeButtonGroupBox; 197 sizeGroupBoxLayout = sizeWidgetGroupBox->layout(); 198 199 #else 200 201 sizeWidgetGroupBox = new QGroupBox(tr("Size")); 202 sizeGroupBoxLayout = new QVBoxLayout(sizeWidgetGroupBox); 203 sizeButtonGroupBox = new QButtonGroup(); 204 original->setChecked( true ); 205 206 original = new QRadioButton("Original"); 207 modify = new QRadioButton("Modify"); 208 209 sizeButtonGroupBox->addButton(modify); 210 sizeButtonGroupBox->addButton(original); 211 sizeButtonGroupBox->setExclusive(true); 212 213 sizeGroupBoxLayout->addWidget(modify); 214 sizeGroupBoxLayout->addWidget(original); 215 216 sizeWidgetGroupBox->setLayout(sizeGroupBoxLayout); 217 #endif 218 219 220 ratioCheckBox = new QCheckBox( "Keep ratio",modifyAndRatioWidget); 199 221 ratioCheckBox->setChecked( true ); 200 222 … … 204 226 modifyAndRatioWidget->setLayout(modifyAndRatioLayout); 205 227 #endif 228 #if QT_VERSION < 0x040000 229 sizeGroupBoxLayout->add(modifyAndRatioWidget); 230 #else 206 231 sizeGroupBoxLayout->addWidget(modifyAndRatioWidget); 232 #endif 207 233 if (modify->isChecked()) { 208 234 ratioCheckBox->show(); … … 211 237 } 212 238 213 connect( original, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(true)) ); 214 connect( modify, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(false) ) ); 239 #if QT_VERSION < 0x040000 240 connect( sizeButtonGroupBox, SIGNAL( clicked(int) ), this, SLOT( changeSizeBox()) ); 241 #else 242 connect( sizeButtonGroupBox, SIGNAL( buttonClicked(int) ), this, SLOT( changeSizeBox()) ); 243 #endif 215 244 216 245 // height 217 246 heightWidget = new QWidget; 218 247 219 #if QT_VERSION < 0x040000220 248 QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget); 221 #else222 QHBoxLayout *heightLineLayout = new QHBoxLayout;223 #endif224 249 225 250 QString tmp; 226 251 227 heightLineLayout->addWidget(new QLabel("Height", 0));228 height = new QLineEdit(tmp.setNum(originalHeight), 0);252 heightLineLayout->addWidget(new QLabel("Height",this)); 253 height = new QLineEdit(tmp.setNum(originalHeight),this); 229 254 height->setMaxLength(5); 255 #if QT_VERSION < 0x040000 256 heightLineLayout->add(height); 257 #else 230 258 heightLineLayout->addWidget(height); 259 #endif 231 260 #if QT_VERSION >= 0x040000 232 261 heightWidget->setLayout(heightLineLayout); 233 262 #endif 263 #if QT_VERSION < 0x040000 264 sizeGroupBoxLayout->add(heightWidget); 265 #else 234 266 sizeGroupBoxLayout->addWidget(heightWidget); 267 #endif 235 268 connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) ); 236 269 … … 239 272 widthWidget = new QWidget; 240 273 241 #if QT_VERSION < 0x040000242 274 QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget); 243 #else 244 QHBoxLayout *widthLineLayout = new QHBoxLayout; 245 #endif 246 247 widthLineLayout->addWidget(new QLabel("Width ",0)); 248 width = new QLineEdit(tmp.setNum(originalWidth),0); 275 276 #if QT_VERSION < 0x040000 277 widthLineLayout->add(new QLabel("Width ",widthWidget)); 278 #else 279 widthLineLayout->addWidget(new QLabel("Width ",widthWidget)); 280 #endif 281 width = new QLineEdit(tmp.setNum(originalWidth),this); 249 282 width->setMaxLength(5); 283 #if QT_VERSION < 0x040000 284 widthLineLayout->add(width); 285 #else 250 286 widthLineLayout->addWidget(width); 287 #endif 251 288 #if QT_VERSION >= 0x040000 252 289 widthWidget->setLayout(widthLineLayout); 253 290 #endif 291 #if QT_VERSION < 0x040000 292 sizeGroupBoxLayout->add(widthWidget); 293 #else 254 294 sizeGroupBoxLayout->addWidget(widthWidget); 295 #endif 255 296 connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) ); 256 297 257 298 #if QT_VERSION >= 0x040000 258 size GroupBox->setLayout(sizeGroupBoxLayout);259 #endif 260 globalVLayout->addWidget(size GroupBox);299 sizeWidgetGroupBox->setLayout(sizeGroupBoxLayout); 300 #endif 301 globalVLayout->addWidget(sizeWidgetGroupBox); 261 302 262 303 heightWidget->hide(); … … 265 306 // button ok/cancel box 266 307 267 QGroupBox *buttonGroupBox = new QGroupBox(); 268 269 #if QT_VERSION < 0x040000 308 QGroupBox *buttonGroupBox = new QGroupBox(this); 309 270 310 QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout(buttonGroupBox); 271 #else 272 QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout; 273 #endif 274 275 buttonOk = new QPushButton( tr( "&OK" ),0 ); 311 312 buttonOk = new QPushButton( tr( "&OK" ),buttonGroupBox ); 276 313 buttonOk->setAutoDefault( TRUE ); 277 314 buttonOk->setDefault( TRUE ); 278 315 buttonGroupBoxLayout->addWidget(buttonOk); 279 316 280 buttonCancel = new QPushButton( tr( "&Cancel" ), 0);317 buttonCancel = new QPushButton( tr( "&Cancel" ),buttonGroupBox ); 281 318 buttonCancel->setAutoDefault( TRUE ); 282 319 buttonGroupBoxLayout->addWidget(buttonCancel); … … 333 370 334 371 335 void G4OpenGLQtExportDialog::changeSizeBox(bool aClick) 336 { 337 if (aClick) { 338 modify->toggle(); 339 } else { 340 original->toggle(); 341 } 372 void G4OpenGLQtExportDialog::changeSizeBox() 373 { 342 374 if ( original->isChecked()) { 343 375 heightWidget->hide(); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog_moc.cc
r632 r633 206 206 ** Meta object code from reading C++ file 'G4OpenGLQtExportDialog.hh' 207 207 ** 208 ** Created: Fri Sep 28 12:35:412007209 ** by: The Qt Meta Object Compiler version 59 (Qt 4. 2.2)208 ** Created: Mon Dec 3 16:30:26 2007 209 ** by: The Qt Meta Object Compiler version 59 (Qt 4.3.0) 210 210 ** 211 211 ** WARNING! All changes made in this file will be lost! 212 212 *****************************************************************************/ 213 214 215 213 216 214 #include "../include/G4OpenGLQtExportDialog.hh" … … 218 216 #error "The header file 'G4OpenGLQtExportDialog.hh' doesn't include <QObject>." 219 217 #elif Q_MOC_OUTPUT_REVISION != 59 220 #error "This file was generated using the moc from 4. 2.2. It"218 #error "This file was generated using the moc from 4.3.0. It" 221 219 #error "cannot be used with the include files from this version of Qt." 222 220 #error "(The moc has changed too much.)" … … 234 232 235 233 // slots: signature, parameters, type, tag, flags 236 23, 43, 43, 43, 0x0a,237 4 4, 43, 43, 43, 0x0a,238 70, 43, 43, 43, 0x0a,234 23, 39, 39, 39, 0x0a, 235 40, 39, 39, 39, 0x0a, 236 66, 39, 39, 39, 0x0a, 239 237 240 238 0 // eod … … 242 240 243 241 static const char qt_meta_stringdata_G4OpenGLQtExportDialog[] = { 244 "G4OpenGLQtExportDialog\0changeSizeBox( bool)\0"242 "G4OpenGLQtExportDialog\0changeSizeBox()\0" 245 243 "\0textWidthChanged(QString)\0" 246 244 "textHeightChanged(QString)\0" … … 261 259 if (!_clname) return 0; 262 260 if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtExportDialog)) 263 return static_cast<void*>(const_cast< G4OpenGLQtExportDialog*>(this));261 return static_cast<void*>(const_cast< G4OpenGLQtExportDialog*>(this)); 264 262 return QDialog::qt_metacast(_clname); 265 263 } … … 272 270 if (_c == QMetaObject::InvokeMetaMethod) { 273 271 switch (_id) { 274 case 0: changeSizeBox( (*reinterpret_cast< bool(*)>(_a[1]))); break;272 case 0: changeSizeBox(); break; 275 273 case 1: textWidthChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; 276 274 case 2: textHeightChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r632 r633 212 212 } 213 213 214 #if QT_VERSION < 0x040000215 214 QHBoxLayout *mainLayout = new QHBoxLayout(GLWindow); 216 #else217 QHBoxLayout *mainLayout = new QHBoxLayout;218 #endif219 215 220 216 mainLayout->addWidget(fWindow);
Note: See TracChangeset
for help on using the changeset viewer.