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
QtWS25 Last Chance

Start an external program from Qt

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

        Yes, but nothing happens ...

        thamT 1 Reply Last reply
        0
        • T Timo_F

          Yes, but nothing happens ...

          thamT Offline
          thamT Offline
          tham
          wrote on 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 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?

            thamT mrjjM 2 Replies Last reply
            0
            • T Timo_F

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

              thamT Offline
              thamT Offline
              tham
              wrote on last edited by
              #6

              @Timo_F Embedding Application Manifest and Version Information using QtCreator.

              1 Reply Last reply
              0
              • T Timo_F

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

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on 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 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 !!

                  mrjjM 1 Reply Last reply
                  0
                  • T Timo_F

                    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 !!

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 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

                    • Login

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