fixing typo, adding eventFilters, etc. see (MUSR-44 in the tracker)

This commit is contained in:
nemu
2009-04-20 06:50:06 +00:00
parent 5667d6bb5e
commit 01ee7c0196
11 changed files with 161 additions and 109 deletions

View File

@@ -34,6 +34,8 @@
#include <qmessagebox.h>
#include <qspinbox.h>
#include <qtextedit.h>
#include <qpushbutton.h>
#include <qevent.h>
#include "PGetParameterDialog.h"
@@ -43,6 +45,9 @@
*/
PGetParameterDialog::PGetParameterDialog()
{
// setup event filter
installEventFilter(this);
fValue_lineEdit->setValidator( new QDoubleValidator(fValue_lineEdit) );
fStep_lineEdit->setValidator( new QDoubleValidator(fStep_lineEdit) );
@@ -175,6 +180,30 @@ void PGetParameterDialog::paramAdd()
fName_lineEdit->setFocus();
}
//----------------------------------------------------------------------------------------------------
/**
* <p>This event filter is filtering out the return key, and if present adds the current parameters
* to the parameter list.
*/
bool PGetParameterDialog::eventFilter( QObject *obj, QEvent *ev )
{
if (obj == this) {
if (ev->type() == QEvent::KeyPress) {
QKeyEvent *k = (QKeyEvent*)ev;
if (k->key() == Qt::Key_Return) {
paramAdd();
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------