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. C++ console application to Qt GUI
QtWS25 Last Chance

C++ console application to Qt GUI

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 5.9k 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.
  • S Offline
    S Offline
    shancat
    wrote on last edited by
    #1

    I have a C++ console application which works fine on Windows 7. It takes parameters and calls certain functions based on these parameters. Can I just "plug" in the source code into a Qt GUI application or will I need to recode it?

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by
      #2

      Since interactions between widgets in Qt is driven by signals / slots mechanism, I'm afraid a bit of recoding will be needed.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        you can use the C++ code, sure. But you have to call it and do somethign with results. There you need to convert the parameters (QString to which ever string impl you used, etc.)

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Or, you just keep the GUI and backend separate, and communicate with the backend process via QProcess.

          You will not need a complete re-code in any way you do it, but you probably will need to wrap your existing code a bit to make it ready to interact with a GUI.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shancat
            wrote on last edited by
            #5

            Sounds like Andre's idea is easiest but the console application that I've made needs to be extremely fast and I'm wondering if the other ideas would make it slower?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Would it be an option to re-factor your original code into two pieces? You might create a library (either static or dynamic) that contains the business end of the code. Then, your command line app can build a simple layer on top of that lib to basically just control the I/O: parse the input parameters, and output results to stdout.

              You could then use that same lib in your GUI application.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                shancat
                wrote on last edited by
                #7

                I was thinking that when I did a bit of research but I have no idea how to implement this. I have only just started with programming (I have a php background) but I'm picking it up fairly quickly. Any resources I can read up on to get this sorted? I use visual studio 2010 express if that helps.

                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