#include "processgcode.h"
#include
#include
#include
#include
#include
#include
processGCode::processGCode(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags) {
ui.setupUi(this);
connect(ui.pushButton_browse,SIGNAL(clicked()),this,SLOT(slot_browseClicked())); //打开按钮,选择要处理的单个文件;
connect(ui.pushButton_convert,SIGNAL(clicked()),this,SLOT(slot_process())); //开始处理文件按钮,点击它,就开始处理文件;
}
void processGCode::slot_browseClicked() {
ui.lineEdit_FilePathAndName->setText(QFileDialog::getOpenFileName(this,tr("Please Select a Program to Process"),"C:/block/",tr("Program (*.ISO)"))); //高手请看,就在这里!这是打开单个文件并进行处理的。如何改成可以打开多个文件,然后依次处理呢?
slot_clearConvertResult();
}
void processGCode::slot_clearConvertResult() {
ui.lineEdit_convertResult->clear();
}
void processGCode::slot_process() {
if ((ui.lineEdit_FilePathAndName->text())!=QString("")) {
ui.lineEdit_convertResult->setText(tr("Converting..."));
if (process(ui.lineEdit_FilePathAndName->text())) {
ui.lineEdit_convertResult->setText(tr("Convert Succeed! Program Stored in ")+outputDirectory);
} //处理成功!
else {
ui.lineEdit_convertResult->setText(tr("Convert Failed!"));//处理失败!
}
}
}
bool processGCode::process(QString programToProcess) {......} //打开单个文件后,对单个文件的内部数据处理;
processGCode::~processGCode() {
}
高手,拜求了!您的一个指点,就可能让我省下一个月或者更多的时间!
拜求了!
connect(ui.pushButton_convert,SIGNAL(clicked()),this,SLOT(slot_process())); //开始处理文件按钮,点击它,就开始处理文件;
下面还有一行,我少粘贴了!
connect(ui.lineEdit_FilePathAndName,SIGNAL(editingFinished()),this,SLOT(slot_clearConvertResult()));
如果您需要整个源程序,请您加我qq112507575