标签:
头文件widget.h
#ifndef WIDGET_H #define WIDGET_H #include <QWidget> namespace Ui { class Widget; } class Widget : public QWidget { Q_OBJECT public: explicit Widget(QWidget *parent = 0); ~Widget(); private slots: void on_submit_clicked(); private: Ui::Widget *ui; }; #endif // WIDGET_H
widget.cpp
#include "widget.h" #include "ui_widget.h" #include <QProcess> Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); } Widget::~Widget() { delete ui; } void Widget::on_submit_clicked() { QProcess *process = new QProcess; QString startProgram = ui->lineEdit->text(); process->start(startProgram.trimmed());
process->close(); }
标签:
原文地址:http://www.cnblogs.com/delphiclub/p/5525702.html