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. Start an external program from Qt
Forum Updated to NodeBB v4.3 + New Features

Start an external program from Qt

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 2.4k 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.
  • T Offline
    T Offline
    Timo_F
    wrote on 9 May 2017, 15:31 last edited by
    #1

    Hello everybody,

    ich developped a vision app and now I want to start that app by pushing a button on an Qt gui.
    More precise the button is on the MainWindow.
    I found a lot of hints in the web but they are not working for me.

    QProcess * my process = new QProcess();
    myprocess-> start("absoulte path", QStreingList() << "Start");
    I also used startDetached , but that's also not working.
    Does anyboy have an example for me?

    Thanks a lot.

    Kindy regards,

    Timo

    1 Reply Last reply
    0
    • L Offline
      L Offline
      luca
      wrote on 9 May 2017, 15:38 last edited by
      #2

      Have you tried with the static call:

      QProcess::startDetached(......);
      
      1 Reply Last reply
      0
      • T Offline
        T Offline
        Timo_F
        wrote on 9 May 2017, 15:46 last edited by
        #3

        Yes, but nothing happens ...

        T 1 Reply Last reply 9 May 2017, 16:03
        0
        • T Timo_F
          9 May 2017, 15:46

          Yes, but nothing happens ...

          T Offline
          T Offline
          tham
          wrote on 9 May 2017, 16:03 last edited by
          #4

          @Timo_F Which platform and Qt version? Any error messages?One of the reasons I could imagine is privilege, if you are doing the task on windows, you need to change the privilege by manifest.

          Example of manifest :

          <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
          <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
              <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                  <security>
                      <requestedPrivileges>
                          <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
                      </requestedPrivileges>
                  </security>
              </trustInfo>
          </assembly>
          

          And call the mt.exe, you can save some trouble by adding following lines in .pro

          win32 {
              WINSDK_DIR = C:/Program Files (x86)/Windows Kits/10
              WIN_PWD = $$replace(PWD, /, \\)
              OUT_PWD_WIN = $$replace(OUT_PWD, /, \\)
              message("output : " + $$OUT_PWD_WIN)
              QMAKE_POST_LINK = "$$WINSDK_DIR/bin/x86/mt.exe -manifest $$quote($$WIN_PWD\\$$basename(TARGET).manifest) -outputresource:$$quote($$OUT_PWD_WIN\\${DESTDIR_TARGET};1)"
          }
          

          Maybe the app compiled by mingw do not need to go through this kind of troubles

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Timo_F
            wrote on 9 May 2017, 16:17 last edited by
            #5

            @tham
            there are no errors ... it's like death. I'm using Qt 5.8 on Windows10.
            Where is the manifest doc?

            T M 2 Replies Last reply 9 May 2017, 16:20
            0
            • T Timo_F
              9 May 2017, 16:17

              @tham
              there are no errors ... it's like death. I'm using Qt 5.8 on Windows10.
              Where is the manifest doc?

              T Offline
              T Offline
              tham
              wrote on 9 May 2017, 16:20 last edited by
              #6

              @Timo_F Embedding Application Manifest and Version Information using QtCreator.

              1 Reply Last reply
              0
              • T Timo_F
                9 May 2017, 16:17

                @tham
                there are no errors ... it's like death. I'm using Qt 5.8 on Windows10.
                Where is the manifest doc?

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 9 May 2017, 16:34 last edited by
                #7

                @Timo_F said in Start an external program from Qt:

                @tham
                there are no errors ... it's like death. I'm using Qt 5.8 on Windows10.

                So you did hook up
                http://doc.qt.io/qt-5/qprocess.html#errorOccurred
                and see what it says ?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Timo_F
                  wrote on 9 May 2017, 16:39 last edited by
                  #8

                  Thank you all a lot. :-)
                  Now it works ... shame on me, it was so simple. I copied and paste the path directly from the explorer and that was not working. Replacing the "" by "/" in the path was the solution !!

                  M 1 Reply Last reply 9 May 2017, 16:41
                  0
                  • T Timo_F
                    9 May 2017, 16:39

                    Thank you all a lot. :-)
                    Now it works ... shame on me, it was so simple. I copied and paste the path directly from the explorer and that was not working. Replacing the "" by "/" in the path was the solution !!

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 9 May 2017, 16:41 last edited by
                    #9

                    @Timo_F
                    Oh its a classic
                    to use

                    \
                    in any c/c++ it must be escaped
                    \\
                    or use / as Qt supports.
                    
                    1 Reply Last reply
                    0

                    4/9

                    9 May 2017, 16:03

                    • Login

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