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

Location:
trunk/geant4/visualization/OpenGL/src
Files:
2 added
2 deleted
6 edited

Legend:

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

    r593 r599  
    159159,int height)
    160160
    161   int side = qMin(width, height);
     161  int side = width;
     162  if (width > height) {
     163    side = height;
     164  }
    162165  glViewport((width - side) / 2, (height - side) / 2, side, side);
    163166  glMatrixMode(GL_PROJECTION);
  • 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}
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r595 r599  
    2525//
    2626//
    27 // $Id: G4OpenGLQtViewer.cc,v 1.3 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLQtViewer.cc,v 1.4 2007/11/09 15:03:22 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    5151#include "G4UImanager.hh"
    5252#include <qapplication.h>
    53 #include <qboxLayout.h>
     53#include <qlayout.h>
    5454#include <qdialog.h>
     55
     56#if QT_VERSION >= 0x040000
    5557#include <qmenu.h>
    5658#include <qimagewriter.h>
     59#else
     60#include <qaction.h>
     61#include <qwidgetlist.h>
     62#include <qmenudata.h>
     63#include <qpopupmenu.h>
     64#include <qimage.h>
     65#endif
     66
    5767#include <qmessagebox.h>
    5868#include <qfiledialog.h>
     
    6272#include <qdialog.h>
    6373#include <qevent.h> //include <qcontextmenuevent.h>
    64 #include <qmenu.h>
    65 #include <qimage.h>
    6674
    6775
     
    100108    G4cerr << "Visualization window not defined, please choose one before" << G4endl;
    101109  } else {
     110#if QT_VERSION < 0x040000
     111    GLWindow->setActiveWindow();
     112#else
    102113    GLWindow->activateWindow();
     114#endif
    103115    printf("G4OpenGLQtViewer::ShowView -----------------------\n");
    104116  }
     
    145157    // look for the main window
    146158    bool found = false;
     159#if QT_VERSION < 0x040000
     160    QWidgetList  *list = QApplication::allWidgets();
     161    QWidgetListIt it( *list );         // iterate over the widgets
     162    QWidget * widget;
     163    while ( (widget=it.current()) != 0 ) {  // for each widget...
     164      ++it;
     165      if ((found== false) && (widget->inherits("QMainWindow"))) {
     166        printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n");
     167        GLWindow = new QDialog(widget,0,FALSE,Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WStyle_MinMax );
     168        found = true;
     169      }
     170    }
     171    delete list;                      // delete the list, not the widgets
     172#else
    147173    foreach (QWidget *widget, QApplication::allWidgets()) {
    148174      if ((found== false) && (widget->inherits("QMainWindow"))) {
     
    152178      }
    153179    }
     180#endif
     181
    154182    if (found==false) {
    155183      printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n");
     
    161189  }
    162190
     191#if QT_VERSION < 0x040000
     192  QHBoxLayout *mainLayout = new QHBoxLayout(GLWindow);
     193#else
    163194  QHBoxLayout *mainLayout = new QHBoxLayout;
     195#endif
    164196
    165197  mainLayout->addWidget(fWindow);
     198
     199#if QT_VERSION < 0x040000
     200  GLWindow->setCaption( tr( "QGl Viewer" ));
     201#else
    166202  GLWindow->setLayout(mainLayout);
    167   GLWindow->setWindowTitle("QGl Viewer");
     203  GLWindow->setWindowTitle(tr("QGl Viewer"));
     204#endif
    168205  GLWindow->resize(300, 300);
    169206  GLWindow->move(900,300);
     
    229266void G4OpenGLQtViewer::createPopupMenu()    {
    230267
     268#if QT_VERSION < 0x040000
     269  fContextMenu = new QPopupMenu( GLWindow,"All" );
     270#else
    231271  fContextMenu = new QMenu("All");
    232 
     272#endif
     273  Q_CHECK_PTR( fContextMenu );
     274
     275#if QT_VERSION < 0x040000
     276  // === Mouse menu ===
     277  QPopupMenu *mMouseAction = new QPopupMenu( fContextMenu );
     278  Q_CHECK_PTR( mMouseAction );
     279
     280  QAction *rotate = new QAction("&Rotate scene",CTRL+Key_N,mMouseAction);
     281  QAction *move =  new QAction("&Move scene",CTRL+Key_M,mMouseAction);
     282  rotate->addTo(mMouseAction);
     283  move->addTo(mMouseAction);
     284
     285  fContextMenu->insertItem( "&Mouse action", mMouseAction);
     286
     287#else
     288  // === Mouse menu ===
    233289  QMenu *mMouseAction = fContextMenu->addMenu("&Mouse action");
     290
    234291  QAction *rotate = mMouseAction->addAction("&Rotate scene");
    235292  QAction *move = mMouseAction->addAction("&Move scene");
     293#endif
     294
    236295  // INIT mMouse
    237296  createRadioAction(rotate,move,SLOT(toggleMouseAction(bool)),1);
    238297
    239   //Style Menu
     298#if QT_VERSION < 0x040000
     299  // === Style Menu ===
     300  QPopupMenu *mStyle = new QPopupMenu(fContextMenu);
     301
     302  QPopupMenu *mRepresentation = new QPopupMenu(fContextMenu);
     303
     304  QAction *polyhedron = new QAction("&Polyhedron",CTRL+Key_P,mRepresentation);
     305  QAction *nurbs = new QAction("&NURBS",CTRL+Key_N,mRepresentation);
     306  polyhedron->addTo(mRepresentation);
     307  nurbs->addTo(mRepresentation);
     308
     309  mStyle->insertItem("&Representation",mRepresentation);
     310  fContextMenu->insertItem("&Style",mStyle);
     311
     312#else
     313  // === Style Menu ===
    240314  QMenu *mStyle = fContextMenu->addMenu("&Style");
    241315
     
    243317  QAction *polyhedron = mRepresentation->addAction("Polyhedron");
    244318  QAction *nurbs = mRepresentation->addAction("NURBS");
     319#endif
    245320  // INIT mStyle
    246321  G4ViewParameters::RepStyle style;
     
    255330
    256331
     332#if QT_VERSION < 0x040000
     333  // === Drawing Menu ===
     334  QPopupMenu *mDrawing = new QPopupMenu(fContextMenu);
     335  fContextMenu->insertItem("&Drawing",mDrawing);
     336
     337  fDrawingWireframe = new QPopupMenu(mDrawing);
     338  mDrawing->insertItem("&Wireframe",fDrawingWireframe);
     339
     340  mDrawing->setCheckable(true);
     341  fDrawingWireframe->setCheckable(true);
     342
     343  fDrawingLineRemoval = new QPopupMenu(mDrawing);
     344  mDrawing->insertItem("&Hidden line removal",fDrawingLineRemoval);
     345  fDrawingLineRemoval->setCheckable(true);
     346
     347  fDrawingSurfaceRemoval = new QPopupMenu(mDrawing);
     348  mDrawing->insertItem("&Hidden surface removal",fDrawingSurfaceRemoval);
     349  fDrawingSurfaceRemoval->setCheckable(true);
     350
     351  fDrawingLineSurfaceRemoval = new QPopupMenu(mDrawing);
     352  mDrawing->insertItem("&Hidden line and surface removal",fDrawingLineSurfaceRemoval);
     353  fDrawingLineSurfaceRemoval->setCheckable(true);
     354
     355#else
     356  // === Drawing Menu ===
    257357  QMenu *mDrawing = mStyle->addMenu("&Drawing");
     358
    258359  fDrawingWireframe = mDrawing->addAction("Wireframe");
    259360  fDrawingWireframe->setCheckable(true);
    260   fDrawingWireframe->setChecked(true);
     361
    261362  fDrawingLineRemoval = mDrawing->addAction("Hidden line removal");
    262363  fDrawingLineRemoval->setCheckable(true);
     364
    263365  fDrawingSurfaceRemoval = mDrawing->addAction("Hidden Surface removal");
    264366  fDrawingSurfaceRemoval->setCheckable(true);
     367
    265368  fDrawingLineSurfaceRemoval = mDrawing->addAction("Hidden line and surface removal");
    266369  fDrawingLineSurfaceRemoval->setCheckable(true);
     370#endif
    267371  // INIT Drawing
    268372  G4ViewParameters::DrawingStyle d_style;
    269373  d_style = fVP.GetDrawingStyle();
    270374 
    271   fDrawingWireframe->setCheckable(true);
    272   fDrawingLineRemoval->setCheckable(true);
    273   fDrawingSurfaceRemoval->setCheckable(true);
    274   fDrawingLineSurfaceRemoval->setCheckable(true);
    275 
     375#if QT_VERSION < 0x040000
     376  if (d_style == G4ViewParameters::wireframe) {
     377    fDrawingWireframe->setItemChecked(0,true);
     378  } else if (d_style == G4ViewParameters::hlr) {
     379    fDrawingLineRemoval->setItemChecked(0,true);
     380  } else if (d_style == G4ViewParameters::hsr) {
     381    fDrawingSurfaceRemoval->setItemChecked(0,true);
     382  } else if (d_style == G4ViewParameters::hlhsr) {
     383    fDrawingLineSurfaceRemoval->setItemChecked(0,true);
     384  } else {
     385    mDrawing->clear();
     386  }
     387#else
    276388  if (d_style == G4ViewParameters::wireframe) {
    277389    fDrawingWireframe->setChecked(true);
     
    285397    mDrawing->clear();
    286398  }
     399#endif
    287400
    288401  QObject ::connect(fDrawingWireframe,
     
    304417
    305418
     419#if QT_VERSION < 0x040000
     420  QPopupMenu *mBackground = new QPopupMenu(mStyle);
     421  mStyle->insertItem("&Background color",mBackground);
     422
     423  QAction *white = new QAction("&White",CTRL+Key_W,mBackground);
     424  QAction *black =  new QAction("&Black",CTRL+Key_B,mBackground);
     425  white->addTo(mBackground);
     426  black->addTo(mBackground);
     427
     428#else
    306429  QMenu *mBackground = mStyle->addMenu("&Background color");
    307430  QAction *white = mBackground->addAction("White");
    308431  QAction *black = mBackground->addAction("Black");
     432
     433#endif
    309434  if (background.GetRed() == 1. &&
    310435      background.GetGreen() == 1. &&
     
    316441
    317442
    318   // Action Menu
     443#if QT_VERSION < 0x040000
     444  // === Action Menu ===
     445  QPopupMenu *mActions = new QPopupMenu(fContextMenu);
     446  fContextMenu->insertItem("&Actions",mActions);
     447
     448  QAction *controlPanels = new QAction("&Control panels",CTRL+Key_C,mActions);
     449  QAction *exitG4 =  new QAction("&Exit to G4Vis >",CTRL+Key_E,mActions);
     450  QAction *createEPS =  new QAction("&Save as ...",CTRL+Key_S,mActions);
     451  controlPanels->addTo(mActions);
     452  exitG4->addTo(mActions);
     453  createEPS->addTo(mActions);
     454
     455#else
     456  // === Action Menu ===
    319457  QMenu *mActions = fContextMenu->addMenu("&Actions");
    320458  QAction *controlPanels = mActions->addAction("Control panels");
    321459  QAction *exitG4 = mActions->addAction("Exit to G4Vis >");
    322460  QAction *createEPS = mActions->addAction("Save as ...");
     461#endif
     462
    323463  QObject ::connect(controlPanels,
    324464                    SIGNAL(triggered()),
     
    335475
    336476
    337   // Special Menu
     477#if QT_VERSION < 0x040000
     478  // === Special Menu ===
     479  QPopupMenu *mSpecial = new QPopupMenu(fContextMenu);
     480  fContextMenu->insertItem("S&pecial",mSpecial);
     481
     482  QPopupMenu *mTransparency = new QPopupMenu(mSpecial);
     483  mSpecial->insertItem("Transparency",mTransparency);
     484
     485  QAction *transparencyOn = new QAction("&On",CTRL+Key_O,mTransparency);
     486  QAction *transparencyOff = new QAction("&Off",CTRL+Key_F,mTransparency);
     487  transparencyOn->addTo(mTransparency);
     488  transparencyOff->addTo(mTransparency);
     489
     490#else
     491  // === Special Menu ===
    338492  QMenu *mSpecial = fContextMenu->addMenu("S&pecial");
    339   QMenu *transparency = mSpecial->addMenu("Transparency");
    340   QAction *transparencyOn = transparency->addAction("On");
    341   QAction *transparencyOff = transparency->addAction("Off");
     493  QMenu *mTransparency = mSpecial->addMenu("Transparency");
     494  QAction *transparencyOn = mTransparency->addAction("On");
     495  QAction *transparencyOff = mTransparency->addAction("Off");
     496#endif
     497
    342498  if (transparency_enabled == false) {
    343499    createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),2);
     
    349505
    350506
     507#if QT_VERSION < 0x040000
     508  QPopupMenu *mAntialiasing = new QPopupMenu(mSpecial);
     509  mSpecial->insertItem("Antialiasing",mAntialiasing);
     510
     511  QAction *antialiasingOn = new QAction("&On",CTRL+Key_O,mAntialiasing);
     512  QAction *antialiasingOff = new QAction("&Off",CTRL+Key_F,mAntialiasing);
     513  antialiasingOn->addTo(mAntialiasing);
     514  antialiasingOff->addTo(mAntialiasing);
     515
     516#else
    351517  QMenu *mAntialiasing = mSpecial->addMenu("Antialiasing");
    352518  QAction *antialiasingOn = mAntialiasing->addAction("On");
    353519  QAction *antialiasingOff = mAntialiasing->addAction("Off");
     520#endif
     521
    354522  if (antialiasing_enabled == false) {
    355523    createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),2);
     
    360528  }
    361529
     530#if QT_VERSION < 0x040000
     531  QPopupMenu *mHaloing = new QPopupMenu(mSpecial);
     532  mSpecial->insertItem("Haloing",mHaloing);
     533
     534  QAction *haloingOn = new QAction("&On",CTRL+Key_O,mHaloing);
     535  QAction *haloingOff = new QAction("&Off",CTRL+Key_F,mHaloing);
     536  haloingOn->addTo(mHaloing);
     537  haloingOff->addTo(mHaloing);
     538#else
    362539  QMenu *mHaloing = mSpecial->addMenu("Haloing");
    363540  QAction *haloingOn = mHaloing->addAction("On");
    364541  QAction *haloingOff = mHaloing->addAction("Off");
     542#endif
    365543  if (haloing_enabled == false) {
    366544    createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),2);
     
    371549  }
    372550
     551#if QT_VERSION < 0x040000
     552  QPopupMenu *mAux = new QPopupMenu(mSpecial);
     553  mSpecial->insertItem("Auxiliairy edges",mAux);
     554
     555  QAction *auxOn = new QAction("&On",CTRL+Key_O,mAux);
     556  QAction *auxOff = new QAction("&Off",CTRL+Key_F,mAux);
     557  auxOn->addTo(mAux);
     558  auxOff->addTo(mAux);
     559
     560#else
    373561  QMenu *mAux = mSpecial->addMenu("Auxiliary edges");
    374562  QAction *auxOn = mAux->addAction("On");
    375563  QAction *auxOff = mAux->addAction("Off");
     564#endif
    376565  if (!fVP.IsAuxEdgeVisible()) {
    377566    createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),1);
     
    381570
    382571
     572#if QT_VERSION < 0x040000
     573  QPopupMenu *mFullScreen = new QPopupMenu(mSpecial);
     574  mSpecial->insertItem("Full screen",mFullScreen);
     575
     576  QAction *fullOn = new QAction("&On",CTRL+Key_O,mFullScreen);
     577  QAction *fullOff = new QAction("&Off",CTRL+Key_F,mFullScreen);
     578  fullOn->addTo(mFullScreen);
     579  fullOff->addTo(mFullScreen);
     580#else
    383581  QMenu *mFullScreen = mSpecial->addMenu("Full screen");
    384582  QAction *fullOn = mFullScreen->addAction("On");
    385583  QAction *fullOff = mFullScreen->addAction("Off");
     584#endif
    386585  createRadioAction(fullOn,fullOff,SLOT(toggleFullScreen(bool)),2);
    387586
     
    415614   @param nCheck: 1 : first action will be set true. 2 : second action will be set true
    416615*/
     616#if QT_VERSION < 0x040000
     617void G4OpenGLQtViewer::createRadioAction(QAction *action1,QAction *action2, const std::string& method,unsigned int nCheck) {
     618
     619  if (action1->parent()->inherits("QPopupMenu")){
     620    ((QPopupMenu*)action1->parent())->setCheckable(true);
     621  }
     622  ((QPopupMenu*)action1->parent())->setItemChecked(0,true);
     623  ((QPopupMenu*)action1->parent())->setItemChecked(1,true);
     624
     625  if (nCheck ==1)
     626    ((QPopupMenu*)action1->parent())->setItemChecked(0,true);
     627  else
     628    ((QPopupMenu*)action1->parent())->setItemChecked(1,true);
     629   
     630  QObject ::connect(action1, SIGNAL(triggered(bool)),action2, SLOT(toggle()));
     631  QObject ::connect(action2, SIGNAL(triggered(bool)),action1, SLOT(toggle()));
     632
     633  QObject ::connect(action1, SIGNAL(toggled(bool)),this, method.c_str());
     634}
     635
     636#else
    417637void G4OpenGLQtViewer::createRadioAction(QAction *action1,QAction *action2, const std::string& method,unsigned int nCheck) {
    418638
     
    431651
    432652}
     653#endif
    433654
    434655/**
     
    770991   @param mButtons mouse button active
    771992*/
     993
     994#if QT_VERSION < 0x040000
     995void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::ButtonState mButtons)
     996#else
    772997void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::MouseButtons mButtons)
     998#endif
    773999{
    7741000  int dx = pos_x - lastPos.x();
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc

    r595 r599  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
     27// $Id: G4OpenGLStoredQt.cc,v 1.2 2007/11/09 15:03:22 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc

    r595 r599  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQtViewer.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
     27// $Id: G4OpenGLStoredQtViewer.cc,v 1.3 2007/11/09 15:03:22 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc

    r593 r599  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.cc,v 1.9 2007/06/15 09:52:52 gcosmo Exp $
    28 // GEANT4 tag $Name: geant4-09-00-ref-01 $
     27// $Id: G4OpenGLViewerMessenger.cc,v 1.10 2007/11/10 14:51:28 allison Exp $
     28// GEANT4 tag $Name: $
    2929
    3030#include "G4OpenGLViewerMessenger.hh"
     
    6464  fpCommandPrintEPS->SetGuidance
    6565    ("Generates files with names G4OpenGL_n.eps, where n is a sequence"
    66      "\nnumber, starting at 0.");
     66     "\nnumber, starting at 0."
     67     "\nCan be \"vectored\" or \"pixmap\" - see \"/vis/ogl/set/printMode\".");
    6768
    6869  fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
Note: See TracChangeset for help on using the changeset viewer.