Commit 589927b7 authored by Dan Lipsa's avatar Dan Lipsa

Set/remove focus when setting a string to a control.

The Script property for Python View is applied when focus exits the control.
This control is special because neither TAB or Enter can be used to
 signal the end of editing.
parent db5bd1ec
......@@ -57,7 +57,9 @@ bool pqAbstractStringEventPlayer::playEvent(QObject* Object, const QString& Comm
int index = object->findText(value);
if(index != -1)
{
object->setFocus(Qt::OtherFocusReason);
object->setCurrentIndex(index);
object->clearFocus();
}
else
{
......@@ -76,13 +78,17 @@ bool pqAbstractStringEventPlayer::playEvent(QObject* Object, const QString& Comm
if(QLineEdit* const object = qobject_cast<QLineEdit*>(Object))
{
object->setFocus(Qt::OtherFocusReason);
object->setText(value);
object->clearFocus();
return true;
}
if (QTextEdit* const object = qobject_cast<QTextEdit*>(Object))
{
object->setFocus(Qt::OtherFocusReason);
object->document()->setPlainText(value);
object->clearFocus();
return true;
}
......
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