added eventFilters and changed the behaviour of the return-key-pressed
This commit is contained in:
parent
01ee7c0196
commit
61f6fd1b9c
@ -33,6 +33,7 @@
|
||||
#include <qlineedit.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qregexp.h>
|
||||
#include <qevent.h>
|
||||
|
||||
#include "PGetFunctionsBlockDialog.h"
|
||||
|
||||
|
@ -44,6 +44,9 @@
|
||||
*/
|
||||
PGetPlotDialog::PGetPlotDialog()
|
||||
{
|
||||
// setup event filter
|
||||
installEventFilter(this);
|
||||
|
||||
fXRangeLow_lineEdit->setValidator( new QDoubleValidator(fXRangeLow_lineEdit) );
|
||||
fXRangeUp_lineEdit->setValidator( new QDoubleValidator(fXRangeUp_lineEdit) );
|
||||
fYRangeLow_lineEdit->setValidator( new QDoubleValidator(fYRangeLow_lineEdit) );
|
||||
@ -144,6 +147,29 @@ void PGetPlotDialog::addPlot()
|
||||
fRunList_lineEdit->setFocus();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This event filter is filtering out the return key, and if present adds the current plot.
|
||||
*/
|
||||
bool PGetPlotDialog::eventFilter( QObject *obj, QEvent *ev )
|
||||
{
|
||||
if (obj == this) {
|
||||
if (ev->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *k = (QKeyEvent*)ev;
|
||||
if (k->key() == Qt::Key_Return) {
|
||||
addPlot();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -43,6 +43,9 @@ class PGetPlotDialog : public PGetPlotDialogBase
|
||||
|
||||
public slots:
|
||||
void addPlot();
|
||||
|
||||
protected:
|
||||
bool eventFilter( QObject *obj, QEvent *ev );
|
||||
};
|
||||
|
||||
#endif // _PGETPLOTDIALOG_H_
|
||||
|
@ -240,7 +240,7 @@ FUNCTIONS
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonOk</sender>
|
||||
<signal>clicked()</signal>
|
||||
<signal>released()</signal>
|
||||
<receiver>PGetFunctionsBlockDialogBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
</connection>
|
||||
|
@ -314,7 +314,7 @@
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>fOk_button</sender>
|
||||
<signal>clicked()</signal>
|
||||
<signal>released()</signal>
|
||||
<receiver>PGetPlotDialogBase</receiver>
|
||||
<slot>accept()</slot>
|
||||
</connection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user