Commit 41396109 authored by Yumin Yuan's avatar Yumin Yuan

Fixes for remaining paraview regressions after switching to master

parent 2144702f
......@@ -42,7 +42,7 @@ pqAbstractDoubleEventPlayer::pqAbstractDoubleEventPlayer(QObject* p)
bool pqAbstractDoubleEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_double")
if(Command != "set_double" && Command != "spin")
return false;
const double value = Arguments.toDouble();
......@@ -54,6 +54,16 @@ bool pqAbstractDoubleEventPlayer::playEvent(QObject* Object, const QString& Comm
object->setValue(value);
return true;
}
else if(Command == "spin" && Arguments == "up")
{
object->stepUp();
return true;
}
else if(Command == "spin" && Arguments == "down")
{
object->stepDown();
return true;
}
}
qCritical() << "calling set_double on unhandled type " << Object;
......
......@@ -43,7 +43,7 @@ pqAbstractIntEventPlayer::pqAbstractIntEventPlayer(QObject* p)
bool pqAbstractIntEventPlayer::playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
{
if(Command != "set_int")
if(Command != "set_int" && Command != "spin")
return false;
const int value = Arguments.toInt();
......@@ -61,6 +61,22 @@ bool pqAbstractIntEventPlayer::playEvent(QObject* Object, const QString& Command
object->setValue(value);
return true;
}
else if(Command == "spin" && Arguments == "up")
{
object->stepUp();
return true;
}
else if(Command == "spin" && Arguments == "down")
{
object->stepDown();
return true;
}
}
if (Command == "spin")
{
// let pqAbstractEventPlayer handle it if possible.
return false;
}
qCritical() << "calling set_int on unhandled type " << Object;
......
......@@ -75,6 +75,20 @@ bool pqDoubleSpinBoxEventTranslator::translateEvent(QObject* Object, QEvent* Eve
}
}
if(Event->type() == QEvent::KeyRelease && Object==object)
{
QKeyEvent* ke = static_cast<QKeyEvent*>(Event);
QString keyText = ke->text();
if(keyText.length() && keyText.at(0).isLetterOrNumber())
{
emit recordEvent(object, "set_double", QString("%1").arg(object->value()));
}
else
{
emit recordEvent(object, "key", QString("%1").arg(ke->key()));
}
}
return true;
}
......
......@@ -77,6 +77,27 @@ bool pqSpinBoxEventTranslator::translateEvent(QObject* Object,
}
}
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<QKeyEvent*>(Event);
QString keyText = ke->text();
this->Value = object->value();
if(keyText.length() && keyText.at(0).isLetterOrNumber())
{
emit recordEvent(object, "set_int", QString("%1").arg(object->value()));
}
else
{
emit recordEvent(object, "key", QString("%1").arg(ke->key()));
}
}
return true;
}
......
......@@ -190,12 +190,22 @@ bool pqTreeViewEventPlayer::playEvent(
{
return true;
}
treeView->setFocus();
treeView->setCurrentIndex(index);
// The following code will cause a modal dialog to close,
// such as the pqColorPresetDialog, if the treeView widget is not handling the key event,
// the key event will bevpropogated to the treeView's parent, in this case the dialog,
// and the dialog be default has OK/Cancel button in focus, and will process the key event,
// close itself. This is causing a few a paraview's tests using pqColorPresetDialog to fail.
// The fix here (above) is to add "treeView->setFocus();" so that the
// "treeView->setCurrentIndex(index);" will trigger selection changed event in treeView,
// which is the purpose of the following code.
/*
QKeyEvent kd(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
QKeyEvent ku(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier);
QCoreApplication::sendEvent(treeView, &kd);
QCoreApplication::sendEvent(treeView, &ku);
*/
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