C++ console application to Qt GUI
-
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?
-
Since interactions between widgets in Qt is driven by signals / slots mechanism, I'm afraid a bit of recoding will be needed.
-
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.)
-
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.
-
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?
-
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.
-
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.