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. How to run a project in QT C++ by another project?
Forum Updated to NodeBB v4.3 + New Features

How to run a project in QT C++ by another project?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 760 Views 2 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.
  • A Offline
    A Offline
    aaaa9271
    wrote on 3 May 2020, 07:56 last edited by
    #1

    Hi There,

    I have a project in Qt c++ (QT Widget application). I want to have a button in my project (App) that by pressing this button, another project in another directory ( a Console project) starts to run. Indeed, the directories of my projects differ from each other. I want to know, is it possible to run my console project by a widget project while these projects are not in the same directory? If yes, how?

    Thank you!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 May 2020, 08:01 last edited by
      #2

      Hi and welcome to devnet,

      To run external application you can use QProcess.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • A Offline
        A Offline
        aaaa9271
        wrote on 3 May 2020, 08:10 last edited by
        #3

        Thank you for your reply. Excuse me if I am asking a low level question. I am beginner in programming.
        I am not going to run another application. I am going to run an external console project by another project in different directories. Does Qprocess method work in this case?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 May 2020, 08:12 last edited by
          #4

          I understood that you wanted to run an application built from a different project. I may have misunderstood you.

          Can you explain the steps you are looking to implement ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • A Offline
            A Offline
            aaaa9271
            wrote on 3 May 2020, 08:36 last edited by
            #5

            This is a summary of what I am going to do:

            I have some console projects that each one is developed for a particular task. I am working on a GUI to control all these projects (for example changing parameters in these projects and also control when to run each one). It is not possible for me to integrate all these projects in one directory (GUI's directory). Hence, I am forced to run these projects through their current directories, which differ from each other.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 3 May 2020, 10:31 last edited by
              #6

              So what's the problem to use QProcess as @SGaist already said?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 3 May 2020, 10:52 last edited by
                #7

                Hi
                QProcess allows running another .exe file anywhere on your drive.
                So yes, you can run the .exe produced by the
                "an external console project by another project"

                    QString program = "c:/path/toyour.exe";
                    QStringList arguments;
                    // if needed:  arguments << "xxxx" << "yyyy";
                    QProcess *myProcess = new QProcess(parent);
                    myProcess->start(program, arguments);
                

                That will start the console as like you had clicked on it.

                1 Reply Last reply
                2

                1/7

                3 May 2020, 07:56

                • Login

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