Changeset 657 for trunk/geant4


Ignore:
Timestamp:
Dec 11, 2007, 6:23:04 PM (17 years ago)
Author:
garnier
Message:

amelioration pour le ticket #101

Location:
trunk/geant4/visualization/OpenGL
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh

    r656 r657  
    4545class QLabel;
    4646class QLineEdit;
     47
     48#if QT_VERSION >= 0x040000
     49class QGroupBox;
     50#endif
    4751
    4852/** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options
     
    111115  QPushButton* buttonOk;
    112116  QPushButton* buttonCancel;
     117
     118#if QT_VERSION >= 0x040000
     119  QGroupBox * sizeGroupBox;
     120#endif
     121
    113122  QCheckBox* transparencyEPS,*boxTransparency,*vectorEPSCheckBox;
    114123  QCheckBox* ratioCheckBox;
     
    121130  int originalWidth;
    122131  int originalHeight;
    123 
     132  bool isChangingSize;
    124133};
    125134
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r656 r657  
    5454 ,int aWidth
    5555)
    56   : QDialog( parent )
     56  : QDialog( parent ),
     57    isChangingSize(false)
    5758{
    5859#if QT_VERSION < 0x040000
     
    130131#else
    131132 
    132   QGroupBox * sizeGroupBox = new QGroupBox(tr("Size"));
     133  sizeGroupBox = new QGroupBox(tr("Size"));
    133134  QVBoxLayout *sizeGroupBoxLayout = new QVBoxLayout(sizeGroupBox);
    134135  QButtonGroup * sizeButtonGroupBox = new QButtonGroup();
     
    401402    modify->setEnabled ( true );
    402403#else
     404    sizeGroupBox->show();
    403405    original->show();
    404406    modify->show();
     
    413415    widthWidget->setEnabled ( false );
    414416#else
     417    sizeGroupBox->hide();
    415418    original->hide();
    416419    modify->hide();
     
    453456}
    454457
     458
    455459void G4OpenGLQtExportDialog::textWidthChanged(
    456460 const QString & s
     
    459463  if (!ratioCheckBox) return;
    460464  if (!width) return;
     465  if (isChangingSize == true) return; // exclusive slot
    461466
    462467  if (ratioCheckBox->isChecked()){
     468    isChangingSize = true;
    463469    QString tmp;
    464     height->setText(tmp.setNum(s.toInt()*originalHeight/originalWidth));
     470  height->setText(tmp.setNum((int)(s.toInt()*(double)((double)originalHeight/(double)originalWidth))));
     471  isChangingSize = false;
    465472  }
    466473}
     
    472479  if (!ratioCheckBox) return;
    473480  if (!width) return;
     481  if (isChangingSize == true) return; // exclusive slot
    474482
    475483  if (ratioCheckBox->isChecked()){
     484  isChangingSize = true;
    476485    QString tmp;
    477486    width->setText(tmp.setNum(s.toInt()*originalWidth/originalHeight));
     487  isChangingSize = false;
    478488  }
    479489}
Note: See TracChangeset for help on using the changeset viewer.