Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QProcess not running command correctly & freezing gui
Forum Updated to NodeBB v4.3 + New Features

QProcess not running command correctly & freezing gui

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    m00k
    wrote on last edited by
    #1

    Hey,
    I know the basics of C++ but am a total QT noob so please treat me accordingly.
    This is the code in question:

    @void gamemode::on_gamemodeoff_clicked()
    {
    QProcess startagain;
    QString startCommand;
    startCommand = ("easystroke & synapse"); // for launching easystroke and synapse (2 programs)

    startagain.start(startCommand, QIODevice::ReadOnly);
    startagain.waitForFinished(-1);
    

    }
    @
    Whenever i run this and press the button my program only launches easystroke then freezes and doesn't launch synapse, what am i doing wrong?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Try ; instead of &. Because I think the second program won't launch until first completes. I'm not sure though.

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        m00k
        wrote on last edited by
        #3

        Thanks for the response,
        If i use: @easystroke ; synapse@ the program does not freeze but still only launches easystroke.

        And if i use: @easystroke &; synapse@ it still only launches easystroke but then freezes.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Hi,

          Another way would be this
          @
          QProcess startagain;
          QString startCommand;
          startCommand = "easystroke";
          startagain.startDetached(startCommand);
          startCommand = "synapse";
          startagain.startDetached(startCommand);
          @

          This will work but there must be more elegant way.

          157

          1 Reply Last reply
          0
          • M Offline
            M Offline
            m00k
            wrote on last edited by
            #5

            Still only launches easystroke and freezes :(.

            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