From 65731ef782db1295902520d4e577d51b5986559f Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 9 Dec 2008 13:48:16 +0000 Subject: [PATCH] *** empty log message *** --- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 51 +++++++++++++++++++++------ src/VISUGUI/VisuGUI_TimeAnimation.h | 20 ++++++----- 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index be5ea1a6..8ae5836a 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -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 ); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index 10cb7ea9..d0aeec1f 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -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(); -- 2.39.2