Fix for bug IPAL18578 (Qt4 porting: Menu - New Entity - Sketch: self activation of Apply button. Impossible to work).

This commit is contained in:
mzn 2008-03-27 07:22:16 +00:00
parent 7de585b1b9
commit 90400ffdc0
2 changed files with 57 additions and 22 deletions

View File

@ -217,26 +217,17 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
connect( Group1Spin->SpinBox_DX, SIGNAL( editingFinished() ),
Group1Spin->buttonApply, SLOT( animateClick() ) );
connect( Group2Spin->SpinBox_DX, SIGNAL( editingFinished() ),
Group2Spin->buttonApply, SLOT( animateClick() ) );
connect( Group2Spin->SpinBox_DY, SIGNAL( editingFinished() ),
Group2Spin->buttonApply, SLOT( animateClick() ) );
connect( Group3Spin->SpinBox_DX, SIGNAL( editingFinished() ),
Group3Spin->buttonApply, SLOT( animateClick() ) );
connect( Group3Spin->SpinBox_DY, SIGNAL( editingFinished() ),
Group3Spin->buttonApply, SLOT( animateClick() ) );
connect( Group3Spin->SpinBox_DZ, SIGNAL( editingFinished() ),
Group3Spin->buttonApply, SLOT( animateClick() ) );
connect( Group4Spin->SpinBox_DX, SIGNAL( editingFinished() ),
Group4Spin->buttonApply, SLOT( animateClick() ) );
connect( Group4Spin->SpinBox_DY, SIGNAL( editingFinished() ),
Group4Spin->buttonApply, SLOT( animateClick() ) );
connect( Group4Spin->SpinBox_DZ, SIGNAL( editingFinished() ),
Group4Spin->buttonApply, SLOT( animateClick() ) );
connect( Group4Spin->SpinBox_DS, SIGNAL( editingFinished() ),
Group4Spin->buttonApply, SLOT( animateClick() ) );
// install event filter on spin-boxes to provide Apply action on Return pressed
Group1Spin->SpinBox_DX->installEventFilter(this);
Group2Spin->SpinBox_DX->installEventFilter(this);
Group2Spin->SpinBox_DY->installEventFilter(this);
Group3Spin->SpinBox_DX->installEventFilter(this);
Group3Spin->SpinBox_DY->installEventFilter(this);
Group3Spin->SpinBox_DZ->installEventFilter(this);
Group4Spin->SpinBox_DX->installEventFilter(this);
Group4Spin->SpinBox_DY->installEventFilter(this);
Group4Spin->SpinBox_DZ->installEventFilter(this);
Group4Spin->SpinBox_DS->installEventFilter(this);
Init();
}
@ -252,6 +243,49 @@ EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg()
}
//=================================================================================
// function : eventFilter()
// purpose : event filter for spin-boxes to provide Apply action on Return pressed
//=================================================================================
bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent* ke = (QKeyEvent*)event;
if (ke->key() == Qt::Key_Return) {
if (object == Group1Spin->SpinBox_DX) {
Group1Spin->buttonApply->animateClick();
return true;
} else if (object == Group2Spin->SpinBox_DX ||
object == Group2Spin->SpinBox_DY) {
Group2Spin->buttonApply->animateClick();
return true;
} else if (object == Group3Spin->SpinBox_DX ||
object == Group3Spin->SpinBox_DY ||
object == Group3Spin->SpinBox_DZ) {
Group3Spin->buttonApply->animateClick();
return true;
} else if (object == Group4Spin->SpinBox_DX ||
object == Group4Spin->SpinBox_DY ||
object == Group4Spin->SpinBox_DZ ||
object == Group4Spin->SpinBox_DS) {
Group4Spin->buttonApply->animateClick();
return true;
}
}
}
if (event->type() == QEvent::KeyRelease) {
// NPAL16010 (Sketcher Apply non available if only one line is modified)
// To have Apply active as soon as value text changed
QDoubleSpinBox* aDoubleSpinBox = (QDoubleSpinBox*)object;
if (aDoubleSpinBox)
ValueChangedInSpinBox( aDoubleSpinBox->value() );
}
return QDialog::eventFilter(object, event);
}
//=================================================================================
// function : Init()
// purpose :
@ -1498,4 +1532,3 @@ void EntityGUI_SketcherDlg::SetDoubleSpinBoxStep( double step )
Group4Spin->SpinBox_DZ->setSingleStep(step);
Group4Spin->SpinBox_DS->setSingleStep(step);
}

View File

@ -63,6 +63,8 @@ public:
const double = 2. );
~EntityGUI_SketcherDlg();
bool eventFilter (QObject* object, QEvent* event);
protected:
void initSpinBox( QDoubleSpinBox*,
double, double, double = 0.1,