2022-07-30 11:50:01 +08:00
|
|
|
|
#include "FilterForm.h"
|
|
|
|
|
|
#include "ui_FilterForm.h"
|
|
|
|
|
|
#include "QMessageBox"
|
|
|
|
|
|
#include <qvalidator.h>
|
|
|
|
|
|
#include "msgbox.h"
|
|
|
|
|
|
|
2022-11-07 14:02:09 +08:00
|
|
|
|
FilterForm::FilterForm(QString strFilter, QWidget *parent) :
|
2022-07-30 11:50:01 +08:00
|
|
|
|
BaseWgt(parent),
|
|
|
|
|
|
ui(new Ui::FilterForm)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
resize(500,320);
|
|
|
|
|
|
setWindowTitle("滤波");
|
|
|
|
|
|
connect(ui->Btn_OK, SIGNAL(clicked()), this, SLOT(SetFilter()));
|
|
|
|
|
|
connect(ui->Btn_Cancel, SIGNAL(clicked()), this, SLOT(Cancel()));
|
|
|
|
|
|
QRegExp rx("[0-9\.]+$");
|
|
|
|
|
|
QRegExpValidator *validator = new QRegExpValidator(rx, this);
|
|
|
|
|
|
ui->lineEdit->setValidator(validator);
|
|
|
|
|
|
ui->lineEdit_2->setValidator(validator);
|
2022-11-07 14:02:09 +08:00
|
|
|
|
QStringList strList = strFilter.split(",");
|
|
|
|
|
|
ui->lineEdit->setText(strList[0]);
|
|
|
|
|
|
ui->lineEdit_2->setText(strList[1]);
|
|
|
|
|
|
|
2022-07-30 11:50:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FilterForm::~FilterForm()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
void FilterForm::Cancel()
|
|
|
|
|
|
{
|
|
|
|
|
|
this->close();
|
|
|
|
|
|
}
|
|
|
|
|
|
void FilterForm::SetFilter()
|
|
|
|
|
|
{
|
|
|
|
|
|
QString Xstart = ui->lineEdit->text();
|
|
|
|
|
|
QString Xend = ui->lineEdit_2->text();
|
|
|
|
|
|
|
|
|
|
|
|
if((Xstart.length() == 0 && Xend.length() == 0))
|
|
|
|
|
|
{
|
|
|
|
|
|
MyMsgBox(QMessageBox::Warning,"警告","请输入正确信息!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(Xstart.toInt() > Xend.toInt())
|
|
|
|
|
|
{
|
|
|
|
|
|
MyMsgBox(QMessageBox::Warning,"警告","请输入正确信息!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
emit sgSetFilter(Xstart+","+Xend);
|
|
|
|
|
|
this->close();
|
|
|
|
|
|
}
|
|
|
|
|
|
void FilterForm::keyPressEvent(QKeyEvent *event)
|
|
|
|
|
|
{
|
|
|
|
|
|
//Enter事件好像这两个都要写,只写event->key() == Qt::Key_Enter,无法实现
|
|
|
|
|
|
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetFilter();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|