Есть:
OutWindow::OutWindow(QWidget *parent) :
QMainWindow(parent)
{
setupUi(this);
QtConcurrent::run(this, &OutWindow::startCleaning);
}
void OutWindow::startCleaning()
{
QProcess *processing;
connect(processing,SIGNAL(readyReadStandardOutput()),this,SLOT(readOut()));
QStringList args;
args<<"-c"<<"../wizard/test";
processing->start("bash",args);
processing->waitForFinished();
}
void OutWindow::readOut()
{
// вот здесь нужно добавить в textOutput новую строку вывода processing, то есть
// textOutput->append(processing->readLine());
// но processing не глобальная переменная
}
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QProcess(0x885c4b8), parent's thread is QThread(0x86be250), current thread is QThread(0x8895c28)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QProcess(0x885c4b8), parent's thread is QThread(0x86be250), current thread is QThread(0x8895c28)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QProcess(0x885c4b8), parent's thread is QThread(0x86be250), current thread is QThread(0x8895c28)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QProcess(0x885c4b8), parent's thread is QThread(0x86be250), current thread is QThread(0x8895c28)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QProcess(0x885c4b8), parent's thread is QThread(0x86be250), current thread is QThread(0x8895c28)
void OutWindow::startCleaning()
{
QProcess *processing;
connect(processing,SIGNAL(readyReadStandardOutput()),this,SLOT(readOut()));
QStringList args;
args<<"-c"<<"../wizard/test";
processing->start("bash",args);
processing->waitForFinished();
}
Нет. =/
Все что я написал, больше ничего.
Разве что там теперь:
QProcess *processing = new QProcess;
Попробуй так
void OutWindow::readOut()
{
QProcess* process = static_cast<QProcess*>(sender());
...
}
Ого! Работает.
А если у меня несколько QProcess?
Форум Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)