Commit cb5fc5cc authored by Benjamin Long's avatar Benjamin Long

Modified Disconnect of QSpinBox:

Most of the time the Spin Box can be modified by other widget.
We only want to record event when we are over this widget.
parent d20436ef
...@@ -54,17 +54,17 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bo ...@@ -54,17 +54,17 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bo
return true; return true;
} }
if(!object) if(!object)
return false; return false;
if(Event->type() == QEvent::Enter && Object==object) if(Event->type() == QEvent::Enter && Object==object)
{ {
if(this->CurrentObject != Object) if(this->CurrentObject != Object)
{ {
if(this->CurrentObject) // if(this->CurrentObject)
{ // {
disconnect(this->CurrentObject, 0, this, 0); // disconnect(this->CurrentObject, 0, this, 0);
} // }
this->CurrentObject = Object; this->CurrentObject = Object;
this->Value = object->value(); this->Value = object->value();
connect(object, SIGNAL(valueChanged(int)),this, SLOT(onValueChanged(int))); connect(object, SIGNAL(valueChanged(int)),this, SLOT(onValueChanged(int)));
...@@ -72,6 +72,12 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bo ...@@ -72,6 +72,12 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bo
} }
} }
if (Event->type() == QEvent::Leave && Object==object)
{
disconnect(this->CurrentObject, 0, this, 0);
this->CurrentObject = 0;
}
if(Event->type() == QEvent::KeyRelease && Object == object) if(Event->type() == QEvent::KeyRelease && Object == object)
{ {
QKeyEvent* ke = static_cast<QKeyEvent*>(Event); QKeyEvent* ke = static_cast<QKeyEvent*>(Event);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment