ramlife

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
class Process : public QObject
{
    Q_OBJECT
public:
    Process()
    {
        connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadData()));
        m_process.setReadChannel(QProcess::StandardOutput);
        m_process.start("cmd /c ping /t www.qt.io");
    }

private slots:
    void onReadData()
    {
        qDebug() << m_process.readAllStandardOutput(); 
    }

private:
    QProcess m_process;
};

参考: https://zhuanlan.zhihu.com/p/86206831

posted on 2020-10-16 10:53  ramlife  阅读(2520)  评论(0编辑  收藏  举报