「Qtの基礎 - プロセス」の版間の差分

ナビゲーションに移動 検索に移動
54行目: 54行目:
   
   
     // プロセス用のシグナルとスロットを接続する
     // プロセス用のシグナルとスロットを接続する
     QObject::connect(&m_proc, SIGNAL(readyReadStandardOutput()), this, SLOT(UpdateOutput()));
     // Qt 4の記述方法
     QObject::connect(&m_proc, SIGNAL(readyReadStandardError()), this, SLOT(UpdateError()));
    //QObject::connect(&m_proc, SIGNAL(readyReadStandardOutput()), this, SLOT(UpdateOutput()));
     QObject::connect(&m_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(ProcessFinished(int, QProcess::ExitStatus)));
     //QObject::connect(&m_proc, SIGNAL(readyReadStandardError()), this, SLOT(UpdateError()));
     //QObject::connect(&m_proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(ProcessFinished(int, QProcess::ExitStatus)));
 
    // Qt 5の規約
    QObject::connect(&m_proc, &QProcess::readyReadStandardOutput, this, &MainWindow::UpdateOutput);
    QObject::connect(&m_proc, &QProcess::readyReadStandardError, this, &MainWindow::UpdateError);
    QObject::connect(&m_proc, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &MainWindow::ProcessFinished);
   
    // Qt 5 (C++14以降)
    //QObject::connect(&m_proc, qOverload<int, QProcess::ExitStatus >(&QProcess::finished), this, &MainWindow::ProcessFinished);
  }
  }
   
   
99行目: 108行目:
  void MainWindow::ProcessStart()
  void MainWindow::ProcessStart()
  {
  {
     QStringList strlArgs;
     QStringList listArgs;
     listArgs << "<引数1>" << "<引数2>";
     listArgs << "<引数1>" << "<引数2>";
   
   

案内メニュー