Problem with connect
Solved
General and Desktop
-
Hello! I'm getting some data from cmd process. The problem is when I click button opens empty window. When I click again data is displayed.
Code:
void TestSettings::runCommand(QStringList arguments) { connect(&process, &QProcess::readyReadStandardOutput, this, &TestSettings::readCmdData); connect(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), this, &TestSettings::finishedProcess); process.start("cmd.exe", arguments); } void TestSettings::readCmdData() { data = process.readAllStandardOutput(); emit testData(data); } void TestSettings::finishedProcess() { connect(this, &TestSettings::testData, &appTestWidow, &TestWindow::getTestData, Qt::DirectConnection); appTestWidow.show(); }
How to fix this problem? Thanks.
-
I fixed this issue by adding connect to constructor and now it's displays data at first button click.