Ignore:
Timestamp:
Nov 12, 2007, 4:42:32 PM (17 years ago)
Author:
garnier
Message:

r636@mac-90108: laurentgarnier | 2007-11-12 16:46:00 +0100
modif pour qt3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r595 r599  
    2525//
    2626//
    27 // $Id: G4OpenGLQtExportDialog.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLQtExportDialog.cc,v 1.3 2007/11/09 15:03:21 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    5454  : QDialog( parent )
    5555{
     56#if QT_VERSION < 0x040000
     57  setCaption( tr( " Export options" ));
     58#else
    5659  setWindowTitle( tr( " Export options" ));
     60#endif
    5761  originalWidth = aWidth;
    5862  originalHeight = aHeight;
     
    6670
    6771  // global layout
     72#if QT_VERSION < 0x040000
     73  QVBoxLayout* globalVLayout = new QVBoxLayout(this);
     74#else
    6875  QVBoxLayout* globalVLayout = new QVBoxLayout();
     76#endif
    6977
    7078 
     
    7381   
    7482    QGroupBox *imageGroupBox = new QGroupBox(tr("Image quality"));
     83#if QT_VERSION < 0x040000
     84    QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout(imageGroupBox);
     85#else
    7586    QVBoxLayout *imageGroupBoxLayout = new QVBoxLayout;
    76 
     87#endif
    7788    QWidget *sliderBox = new QWidget;
     89
     90#if QT_VERSION < 0x040000
     91    QHBoxLayout *hSlider = new QHBoxLayout(sliderBox);
     92#else
    7893    QHBoxLayout *hSlider = new QHBoxLayout;
     94#endif
     95
    7996    //    qualityLabel =  new QLabel( tr( "Image quality" ) );
    8097    //    imageGroupBoxLayout->addWidget(qualityLabel);
    81     qualitySlider= new QSlider(Qt::Horizontal);
     98    qualitySlider= new QSlider(Qt::Horizontal,0);
     99#if QT_VERSION < 0x040000
     100    qualitySlider->setMinValue(0);
     101    qualitySlider->setMaxValue(100);
     102    qualitySlider->setTickmarks(QSlider::Below);
     103#else
    82104    qualitySlider->setMinimum(0);
    83105    qualitySlider->setMaximum(100);
    84106    qualitySlider->setTickPosition(QSlider::TicksBelow);
     107#endif
    85108    qualitySlider->setValue(60);
    86     hSlider->addWidget(new QLabel("low"));
     109    hSlider->addWidget(new QLabel("low",0));
    87110    hSlider->addWidget(qualitySlider);
    88     hSlider->addWidget(new QLabel("Maximum"));
     111    hSlider->addWidget(new QLabel("Maximum",0));
     112#if QT_VERSION >= 0x040000
    89113    sliderBox->setLayout(hSlider);
     114#endif
    90115    imageGroupBoxLayout->addWidget(sliderBox);
    91116
     117#if QT_VERSION >= 0x040000
    92118    imageGroupBox->setLayout(imageGroupBoxLayout);
     119#endif
    93120    globalVLayout->addWidget(imageGroupBox);
    94121  }
     
    96123  if(nomFich.endsWith(".eps")) {
    97124    QGroupBox *EPSGroupBox = new QGroupBox(tr("EPS options"));
     125
     126#if QT_VERSION < 0x040000
     127    QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout(EPSGroupBox);
     128#else
    98129    QVBoxLayout *EPSGroupBoxLayout = new QVBoxLayout;
     130#endif
    99131
    100132    //    transparencyEPS = new QCheckBox( "transparencyEPS" );
     
    102134    //    transparencyEPS->setChecked( true );
    103135
    104     colorButton = new QRadioButton("Color");
    105     BWButton = new QRadioButton("Grayscale");
     136    colorButton = new QRadioButton("Color",0);
     137    BWButton = new QRadioButton("Grayscale",0);
    106138    colorButton->setChecked( true );
    107139    BWButton->setChecked( false );
     
    111143    EPSGroupBoxLayout->addWidget(colorButton);   
    112144    EPSGroupBoxLayout->addWidget(BWButton);   
     145#if QT_VERSION >= 0x040000
    113146    EPSGroupBox->setLayout(EPSGroupBoxLayout);
     147#endif
    114148    globalVLayout->addWidget(EPSGroupBox);
    115149
     
    123157
    124158    QGroupBox *transparencyGroupBox = new QGroupBox(tr("Transparency"));
     159#if QT_VERSION < 0x040000
     160    QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout(transparencyGroupBox);
     161#else
    125162    QVBoxLayout *transparencyGroupBoxLayout = new QVBoxLayout;
    126 
    127     boxTransparency = new QCheckBox("Save transparency");
     163#endif
     164
     165    boxTransparency = new QCheckBox("Save transparency",0);
    128166    boxTransparency->setChecked( false );
    129167    //    boxTransparency->setEnabled(false);
    130168
    131169    transparencyGroupBoxLayout->addWidget(boxTransparency);   
     170#if QT_VERSION >= 0x040000
    132171    transparencyGroupBox->setLayout(transparencyGroupBoxLayout);
     172#endif
    133173    globalVLayout->addWidget(transparencyGroupBox);
    134174
     
    137177  // size box
    138178  QGroupBox *sizeGroupBox = new QGroupBox(tr("Size"));
     179  QWidget* modifyAndRatioWidget = new QWidget;
     180
     181#if QT_VERSION < 0x040000
     182  QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout(modifyAndRatioWidget);
     183  QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
     184#else
     185  QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout;
    139186  QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout;
    140  
    141   QHBoxLayout *modifyAndRatioLayout = new QHBoxLayout;
    142   QWidget* modifyAndRatioWidget = new QWidget;
     187#endif
    143188
    144189  // original button
    145   original = new QRadioButton("Original");
     190  original = new QRadioButton("Original",0);
    146191  original->setChecked( true );
    147192  sizeGroupBoxLayout->addWidget(original);
    148193
    149194  // modify and ratio
    150   modify = new QRadioButton("Modify");
     195  modify = new QRadioButton("Modify",0);
    151196  modify->setChecked( false );
    152197
    153   ratioCheckBox = new QCheckBox( "Keep ratio" );
     198  ratioCheckBox = new QCheckBox( "Keep ratio",0 );
    154199  ratioCheckBox->setChecked( true );
    155200
    156201  modifyAndRatioLayout->addWidget(modify);
    157202  modifyAndRatioLayout->addWidget(ratioCheckBox);
     203#if QT_VERSION >= 0x040000
    158204  modifyAndRatioWidget->setLayout(modifyAndRatioLayout);
     205#endif
    159206  sizeGroupBoxLayout->addWidget(modifyAndRatioWidget);
    160   ratioCheckBox->setVisible(modify->isChecked());
     207  if (modify->isChecked()) {
     208    ratioCheckBox->show();
     209  } else {
     210    ratioCheckBox->hide();
     211  }
    161212
    162213  connect( original, SIGNAL( clicked(bool) ), this, SLOT( changeSizeBox(true)) );
     
    164215
    165216  // height
     217  heightWidget = new QWidget;
     218
     219#if QT_VERSION < 0x040000
     220  QHBoxLayout *heightLineLayout = new QHBoxLayout(heightWidget);
     221#else
    166222  QHBoxLayout *heightLineLayout = new QHBoxLayout;
    167   heightWidget = new QWidget;
     223#endif
     224
    168225  QString tmp;
    169226 
    170   heightLineLayout->addWidget(new QLabel("Height"));
    171   height = new QLineEdit(tmp.setNum(originalHeight));
     227  heightLineLayout->addWidget(new QLabel("Height",0));
     228  height = new QLineEdit(tmp.setNum(originalHeight),0);
    172229  height->setMaxLength(5);
    173230  heightLineLayout->addWidget(height);
     231#if QT_VERSION >= 0x040000
    174232  heightWidget->setLayout(heightLineLayout);
     233#endif
    175234  sizeGroupBoxLayout->addWidget(heightWidget);
    176235  connect( height, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textHeightChanged(const QString &) ) );
     
    178237
    179238  // width
     239  widthWidget = new QWidget;
     240
     241#if QT_VERSION < 0x040000
     242  QHBoxLayout *widthLineLayout = new QHBoxLayout(widthWidget);
     243#else
    180244  QHBoxLayout *widthLineLayout = new QHBoxLayout;
    181   widthWidget = new QWidget;
    182 
    183   widthLineLayout->addWidget(new QLabel("Width "));
    184   width = new QLineEdit(tmp.setNum(originalWidth));
     245#endif
     246
     247  widthLineLayout->addWidget(new QLabel("Width ",0));
     248  width = new QLineEdit(tmp.setNum(originalWidth),0);
    185249  width->setMaxLength(5);
    186250  widthLineLayout->addWidget(width);
     251#if QT_VERSION >= 0x040000
    187252  widthWidget->setLayout(widthLineLayout);
     253#endif
    188254  sizeGroupBoxLayout->addWidget(widthWidget);
    189255  connect( width, SIGNAL( textChanged ( const QString& ) ), this, SLOT( textWidthChanged(const QString &) ) );
    190256
     257#if QT_VERSION >= 0x040000
    191258  sizeGroupBox->setLayout(sizeGroupBoxLayout);
     259#endif
    192260  globalVLayout->addWidget(sizeGroupBox);
    193261
    194   heightWidget->setVisible(false);
    195   widthWidget->setVisible(false);
     262  heightWidget->hide();
     263  widthWidget->hide();
    196264
    197265  // button ok/cancel box
    198266
    199267  QGroupBox *buttonGroupBox = new QGroupBox();
     268
     269#if QT_VERSION < 0x040000
     270  QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout(buttonGroupBox);
     271#else
    200272  QHBoxLayout *buttonGroupBoxLayout = new QHBoxLayout;
    201 
    202   buttonOk = new QPushButton( tr( "&OK" ) );
     273#endif
     274
     275  buttonOk = new QPushButton( tr( "&OK" ),0 );
    203276  buttonOk->setAutoDefault( TRUE );
    204277  buttonOk->setDefault( TRUE );
    205278  buttonGroupBoxLayout->addWidget(buttonOk);
    206279
    207   buttonCancel = new QPushButton( tr( "&Cancel" ) );
     280  buttonCancel = new QPushButton( tr( "&Cancel" ),0 );
    208281  buttonCancel->setAutoDefault( TRUE );
    209282  buttonGroupBoxLayout->addWidget(buttonCancel);
    210283
     284#if QT_VERSION >= 0x040000
    211285  buttonGroupBox->setLayout(buttonGroupBoxLayout);
     286#endif
    212287  globalVLayout->addWidget(buttonGroupBox);
    213288
    214289
     290#if QT_VERSION >= 0x040000
    215291  setLayout(globalVLayout);
     292#endif
    216293
    217294  // signals and slots connections
     
    264341  }
    265342  if ( original->isChecked()) {
    266     heightWidget->setVisible(false);
    267     widthWidget->setVisible(false);
    268     ratioCheckBox->setVisible(false);
     343    heightWidget->hide();
     344    widthWidget->hide();
     345    ratioCheckBox->hide();
    269346  } else {
    270     heightWidget->setVisible(true);
    271     widthWidget->setVisible(true);
    272     ratioCheckBox->setVisible(true);
     347    heightWidget->show();
     348    widthWidget->show();
     349    ratioCheckBox->show();
    273350  }
    274351}
Note: See TracChangeset for help on using the changeset viewer.