Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with connect

Problem with connect

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 453 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by Cobra91151
    #1

    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.

    1 Reply Last reply
    0
    • Cobra91151C Offline
      Cobra91151C Offline
      Cobra91151
      wrote on last edited by
      #2

      I fixed this issue by adding connect to constructor and now it's displays data at first button click.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved