]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
*** empty log message *** V5_1_0rc2
authorstv <stv@opencascade.com>
Tue, 9 Dec 2008 13:48:16 +0000 (13:48 +0000)
committerstv <stv@opencascade.com>
Tue, 9 Dec 2008 13:48:16 +0000 (13:48 +0000)
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_TimeAnimation.h

index be5ea1a628f2ee22d4b9d6a9af62f5741be18cf4..8ae5836a5122c85356071d697d6097c0b2415fea 100644 (file)
@@ -633,7 +633,34 @@ void ArrangeDlg::acceptViewWindow()
 
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
+
+class SetupDlg::LineEdit : public QLineEdit
+{
+public:
+  LineEdit( QWidget* p = 0 ) : QLineEdit( p ) {}
+  virtual ~LineEdit() {}
+
+protected:
+  void    focusOutEvent( QFocusEvent* e )
+  {
+    QLineEdit::focusOutEvent( e );
+
+    if ( text().isEmpty() )
+      emit editingFinished();
+  }
+  void    keyPressEvent( QKeyEvent* e )
+  {
+    QLineEdit::keyPressEvent( e );
+
+    if ( text().isEmpty() && e->key() == Qt::Key_Return )
+      emit returnPressed();
+  }
+};
+
+
 //------------------------------------------------------------------------
+//------------------------------------------------------------------------
+
 SetupDlg::SetupDlg (QWidget* theParent,
                    VisuGUI* theModule,
                    VISU_TimeAnimation* theAnimator) :
@@ -674,15 +701,16 @@ SetupDlg::SetupDlg (QWidget* theParent,
   QLabel* aMinLbl = new QLabel("From", myUseRangeBox);
   aRangeLayout->addWidget(aMinLbl);
   //myMinVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
-  myMinVal = new QLineEdit(myUseRangeBox);
+  myMinVal = new LineEdit( myUseRangeBox );
   myMinVal->setValidator( new QDoubleValidator( myMinVal ) );
-  if (myUseRangeBox->isChecked())
-    myMinVal->setText( QString::number(myAnimator->getMinRange()) );
+  if ( myUseRangeBox->isChecked() )
+    myMinVal->setText( QString::number( myAnimator->getMinRange() ) );
   else
-    myMinVal->setText( QString::number(aMinTime) );
+    myMinVal->setText( QString::number( aMinTime ) );
 
   //  connect(myMinVal, SIGNAL( valueChanged(double)),
   //     this, SLOT( onMinValue(double) ));
+  connect( myMinVal, SIGNAL( returnPressed() ), this, SLOT( onMinValue() ) );
   connect( myMinVal, SIGNAL( editingFinished() ), this, SLOT( onMinValue() ) );
 //   connect( myMinVal, SIGNAL( textChanged(const QString&)),
 //       this, SLOT( onMinValueEdit(const QString&) ));
@@ -691,15 +719,16 @@ SetupDlg::SetupDlg (QWidget* theParent,
   QLabel* aMaxLbl = new QLabel("To", myUseRangeBox);
   aRangeLayout->addWidget(aMaxLbl);
   //myMaxVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
-  myMaxVal = new QLineEdit(myUseRangeBox);
+  myMaxVal = new LineEdit( myUseRangeBox );
   myMaxVal->setValidator( new QDoubleValidator( myMaxVal ) );
-  if (myUseRangeBox->isChecked())
-    myMaxVal->setText( QString::number(myAnimator->getMaxRange()) );
-  else {
-    myMaxVal->setText( QString::number(aMaxTime) );
-  }
+  if ( myUseRangeBox->isChecked() )
+    myMaxVal->setText( QString::number( myAnimator->getMaxRange() ) );
+  else
+    myMaxVal->setText( QString::number( aMaxTime ) );
+
   //  connect(myMaxVal, SIGNAL( valueChanged(double)),
   //     this, SLOT( onMaxValue(double) ));
+  connect( myMaxVal, SIGNAL( returnPressed() ), this, SLOT( onMaxValue() ) );
   connect( myMaxVal, SIGNAL( editingFinished() ), this, SLOT( onMaxValue() ) );
 //   connect(myMaxVal, SIGNAL( textChanged(const QString&)),
 //       this, SLOT( onMaxValueEdit(const QString&) ));
@@ -821,7 +850,7 @@ SetupDlg::SetupDlg (QWidget* theParent,
   aBtnLayout->setContentsMargins( 5, 5, 0, 5 );
   //  aBtnLayout->addStretch();
 
-  QPushButton* closeBtn = new QPushButton( tr( "BUT_CLOSE" ), aBtnBox );
+  QPushButton* closeBtn = new QPushButton( tr( "BUT_OK" ), aBtnBox );
   closeBtn->setAutoDefault( false );
   aBtnLayout->addStretch();
   aBtnLayout->addWidget( closeBtn );
index 10cb7ea907f14323794020d9a3c1e2dbcf0c69fd..d0aeec1ffa4ef2712773f30321d0ab0f48eeda8a 100644 (file)
@@ -47,7 +47,7 @@ class VisuGUI;
 class SalomeApp_Module;
 class VISU_TimeAnimation;
 
-namespace VISU 
+namespace VISU
 {
   class Prs3d_i;
   class PointMap3d_i;
@@ -76,10 +76,10 @@ class ArrangeDlg: public QDialog
   enum { AutoMode, ManualMode };
   enum { XAxis, YAxis, ZAxis };
 
-  ArrangeDlg(QWidget* theParent, 
+  ArrangeDlg(QWidget* theParent,
             VISU_TimeAnimation* theAnimator);
 
-  ArrangeDlg(QWidget* theParent, 
+  ArrangeDlg(QWidget* theParent,
             const SalomeApp_Module* theModule,
             SVTK_ViewWindow* theViewWindow);
 
@@ -121,13 +121,15 @@ class ArrangeDlg: public QDialog
 };
 
 
-class SetupDlg: public QDialog {
+class SetupDlg : public QDialog
+{
   Q_OBJECT
 
+ class LineEdit;
+
  public:
-  SetupDlg(QWidget* theParent,
-          VisuGUI* theModule, 
-          VISU_TimeAnimation* theAnimator);
+  SetupDlg( QWidget* theParent, VisuGUI* theModule,
+           VISU_TimeAnimation* theAnimator );
   ~SetupDlg() {};
 
  public:
@@ -183,7 +185,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog
     Q_OBJECT
  public:
     VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
-                            _PTR(Study) theStudy, 
+                            _PTR(Study) theStudy,
                             VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
     ~VisuGUI_TimeAnimationDlg();
 
@@ -197,7 +199,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog
     virtual void showEvent(QShowEvent* theEvent);
     virtual void keyPressEvent(QKeyEvent* theEvent);
     void stopAnimation();
-    
+
  private slots:
    void onTypeChange(int index);
    void onPlayPressed();