Commit 18f59c7e authored by Benjamin Long's avatar Benjamin Long

Fix crash when user press F2 to edit the TreeView

parent dfce1f57
...@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqLineEditEventTranslator.h" #include "pqLineEditEventTranslator.h"
#include <QEvent> #include <QEvent>
#include <QDebug>
#include <QLineEdit> #include <QLineEdit>
#include <QSpinBox> #include <QSpinBox>
#include <QTextDocument> #include <QTextDocument>
...@@ -53,7 +54,8 @@ bool pqLineEditEventTranslator::translateEvent(QObject* Object, QEvent* Event, b ...@@ -53,7 +54,8 @@ bool pqLineEditEventTranslator::translateEvent(QObject* Object, QEvent* Event, b
return false; return false;
} }
// If this line edit is part of a spinbox, don't translate events (the spinbox translator will receive the final value directly) // If this line edit is part of a spinbox, don't translate events
// (the spinbox translator will receive the final value directly)
if(qobject_cast<QSpinBox*>(Object->parent())) if(qobject_cast<QSpinBox*>(Object->parent()))
{ {
return false; return false;
...@@ -76,8 +78,11 @@ bool pqLineEditEventTranslator::translateEvent(QObject* Object, QEvent* Event, b ...@@ -76,8 +78,11 @@ bool pqLineEditEventTranslator::translateEvent(QObject* Object, QEvent* Event, b
emit recordEvent(Object, "set_string", teObject->document()->toPlainText()); emit recordEvent(Object, "set_string", teObject->document()->toPlainText());
} }
} }
else // if we record F2 event, will cause some issue with the TreeView
// Need test to know if we need to record those events
else if (ke->key() != Qt::Key_F2)
{ {
qDebug() << "key text" << ke->text();
emit recordEvent(Object, "key", QString("%1").arg(ke->key())); emit recordEvent(Object, "key", QString("%1").arg(ke->key()));
} }
} }
......
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