标签:qt
使用在windows下面的windows+R实现的运行程序
widget.h
#ifndef WIDGET_H
#define WIDGET_H#endif // WIDGET_H
main.cpp
#include <QtGui/QApplication>
#include "widget.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
#include "widget.h"
#include "ui_widget.h"
#include <QWidget>
#include <QProcess>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
this->setMaximumSize(391,171);
this->setMinimumSize(391,171);
QObject::connect(ui->cmdLineEdit,SIGNAL(returnPressed()),this,SLOT(on_submitButton_clicked()));
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_submitButton_clicked()
{
QProcess *process = new QProcess;
QString startProgram=ui->cmdLineEdit->text();
process->start(startProgram.trimmed());
ui->cmdLineEdit->clear();
this->close();
}
widget.cpp
标签:qt
原文地址:http://blog.csdn.net/u011046042/article/details/39160007