#include <qwt_wheel.h>
#define MAXVAL 1e10
+#define VALPRECISION 8
ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
: QDialog(theParent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
double aMaxTime = myAnimator->getMaxTime();
double aMinTime = myAnimator->getMinTime();
- double aStep;
+ double aStep = 1;
if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL )
aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1);
else { // successive animation mode
QLabel* aMinLbl = new QLabel("From", myUseRangeBox);
aRangeLayout->addWidget(aMinLbl);
- myMinVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
+ //myMinVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
+ myMinVal = new QLineEdit(myUseRangeBox);
+ myMinVal->setValidator(new QDoubleValidator(aMinTime, aMaxTime, VALPRECISION, myMinVal));
if (myUseRangeBox->isChecked())
- myMinVal->setValue( myAnimator->getMinRange() );
+ myMinVal->setText( QString::number(myAnimator->getMinRange()) );
else
- myMinVal->setValue( aMinTime );
-
- connect(myMinVal, SIGNAL( valueChanged(double)),
- this, SLOT( onMinValue(double) ));
+ myMinVal->setText( QString::number(aMinTime) );
+
+ // connect(myMinVal, SIGNAL( valueChanged(double)),
+ // this, SLOT( onMinValue(double) ));
+ connect(myMinVal, SIGNAL( editingFinished()),
+ this, SLOT( onMinValue() ));
+ connect(myMinVal, SIGNAL( textChanged(const QString&)),
+ this, SLOT( onMinValueEdit(const QString&) ));
aRangeLayout->addWidget(myMinVal);
QLabel* aMaxLbl = new QLabel("To", myUseRangeBox);
aRangeLayout->addWidget(aMaxLbl);
- myMaxVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
+ //myMaxVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
+ myMaxVal = new QLineEdit(myUseRangeBox);
+ myMaxVal->setValidator(new QDoubleValidator(aMinTime, aMaxTime, VALPRECISION, myMaxVal));
if (myUseRangeBox->isChecked())
- myMaxVal->setValue( myAnimator->getMaxRange() );
- else
- myMaxVal->setValue( aMaxTime );
-
- connect(myMaxVal, SIGNAL( valueChanged(double)),
- this, SLOT( onMaxValue(double) ));
+ myMaxVal->setText( QString::number(myAnimator->getMaxRange()) );
+ else {
+ myMaxVal->setText( QString::number(aMaxTime) );
+ }
+ // connect(myMaxVal, SIGNAL( valueChanged(double)),
+ // this, SLOT( onMaxValue(double) ));
+ connect(myMaxVal, SIGNAL( editingFinished() ),
+ this, SLOT( onMaxValue() ));
+ connect(myMaxVal, SIGNAL( textChanged(const QString&)),
+ this, SLOT( onMaxValueEdit(const QString&) ));
aRangeLayout->addWidget(myMaxVal);
connect(myUseRangeBox, SIGNAL( toggled(bool)),
if (!theCheck)
myAnimator->setAnimationRange(0, 0);
else
- myAnimator->setAnimationRange(myMinVal->value(), myMaxVal->value());
+ myAnimator->setAnimationRange(myMinVal->text().toDouble(), myMaxVal->text().toDouble());
setIsRegenerate( true );
}
//------------------------------------------------------------------------
-void SetupDlg::onMinValue (double theVal)
+void SetupDlg::onMinValue ()
{
- if (theVal > myAnimator->getMaxRange()) {
- myMinVal->setValue( myAnimator->getMinTime() );
+ double aVal = myMinVal->text().toDouble();
+ if (aVal > myAnimator->getMaxRange()) {
+ myMinVal->setText( QString::number(myAnimator->getMinTime()) );
myMinVal->setFocus();
return;
}
- myAnimator->setAnimationRange(theVal, myAnimator->getMaxRange());
+ myAnimator->setAnimationRange(aVal, myAnimator->getMaxRange());
setIsRegenerate( true );
}
//------------------------------------------------------------------------
-void SetupDlg::onMaxValue (double theVal)
+void SetupDlg::onMaxValue ()
{
- if (theVal < myAnimator->getMinRange()) {
- myMaxVal->setValue( myAnimator->getMaxTime() );
+ double aVal = myMaxVal->text().toDouble();
+ if (aVal < myAnimator->getMinRange()) {
+ myMaxVal->setText( QString::number(myAnimator->getMaxTime()) );
myMaxVal->setFocus();
return;
- }
- myAnimator->setAnimationRange(myAnimator->getMinRange(), theVal);
+ }
+ myAnimator->setAnimationRange(myAnimator->getMinRange(), aVal);
setIsRegenerate( true );
}
+//------------------------------------------------------------------------
+void SetupDlg::onMinValueEdit (const QString& theVal)
+{
+ double aVal = theVal.toDouble();
+ if ((aVal > myAnimator->getMaxRange()) || (aVal < myAnimator->getMinRange())){
+ myMinVal->setText( QString::number(myAnimator->getMinTime()) );
+ myMinVal->setFocus();
+ return;
+ }
+}
+
+//------------------------------------------------------------------------
+void SetupDlg::onMaxValueEdit (const QString& theVal)
+{
+ double aVal = theVal.toDouble();
+ if ((aVal > myAnimator->getMaxRange()) || (aVal < myAnimator->getMinRange())) {
+ myMaxVal->setText( QString::number(myAnimator->getMaxTime()) );
+ myMaxVal->setFocus();
+ }
+}
//------------------------------------------------------------------------
void SetupDlg::onSequenceCheck( bool theCheck )