From cb5fc5cc87a68b0a14755670bce7c5978a8a59f6 Mon Sep 17 00:00:00 2001 From: Benjamin Long Date: Tue, 20 Mar 2012 11:10:55 -0400 Subject: [PATCH] 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. --- pqSpinBoxEventTranslator.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pqSpinBoxEventTranslator.cxx b/pqSpinBoxEventTranslator.cxx index ffee69c..b54f6c2 100644 --- a/pqSpinBoxEventTranslator.cxx +++ b/pqSpinBoxEventTranslator.cxx @@ -54,17 +54,17 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Event, bo return true; } - if(!object) + if(!object) return false; if(Event->type() == QEvent::Enter && Object==object) { if(this->CurrentObject != Object) { - if(this->CurrentObject) - { - disconnect(this->CurrentObject, 0, this, 0); - } +// if(this->CurrentObject) +// { +// disconnect(this->CurrentObject, 0, this, 0); +// } this->CurrentObject = Object; this->Value = object->value(); connect(object, SIGNAL(valueChanged(int)),this, SLOT(onValueChanged(int))); @@ -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) { QKeyEvent* ke = static_cast(Event); -- GitLab