[問題] 想請問QT中呼叫外部程式的用法
遇到的問題: (題意請描述清楚)
我想寫出一個按鈕按下可以呼叫出一個編譯好的.exe檔,我使用了connect,但是在SLOT那邊不知該怎麼寫
開發平台: (例: VC++ or gcc/g++ or Dev-C++, Windows or Linux)
Linux
有問題的code: (請善用置底文標色功能)
#include <QApplication>
#include <QProcess>
#include <QThread>
#include <QPushButton>
class MyThread : public QThread
{
public slots:
void run();
};
void MyThread::run()
{
QProcess::execute("PATH");
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyThread *thread=new MyThread;
thread->start();
QPushButton *hello=new QPushButton("Hello world!");
QObject::connect( hello, SIGNAL( clicked() ), thread, SLOT(run())) ;
hello->show();
return app.exec();
}
補充說明:
請問一下這樣thread那邊該如何改寫才是正確的呢?
謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.212.209
→
10/23 13:31, , 1F
10/23 13:31, 1F
→
10/23 13:31, , 2F
10/23 13:31, 2F
→
10/24 00:18, , 3F
10/24 00:18, 3F