Interfacing existing C++ console application with GUI in Qt.

  • Hello everyone. Learning basic programming in C/C++. So far only simple console applications, mostly with Code Blocks. Now I have made a console application (parcel/package mangement system), to which I want to add a GUI, so I am giving Qt a try.
    The program is complete in console form. Now I just want to add simple GUI, so that when a certain button is pressed an object is created, or its function is executed. However it seems many things have to change. For example, before this I took input for different fields (name, address etc of one person) separately and put them in separate strings and wrote them to a file. Now I want the user to give the input into different fields in a window and click Ok, which will put all that information into the strings and write them to the intended file.
    So I just want some pointers to get started. How do I do the above mentioned tasks? Do I have to re-write the input functions for the signal slot mechanism? How do I associate each field with a string associated to an object so that something input into a textbox goes to that string when Ok is clicked? The standard C++ libraries (iostream, fstream, string.h, sstream etc don't work when the project type is Qt GUI application), so which project type should I choose for the intended purpose?

    Will be thankful for answers.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should have a look at the examples and demos provided with the Qt documentation, they cover all the areas your are interested in.

  • The Qt GUI application supports iostream etc. You just need to include the namespace for it. Since the situation that you give isn't a code example we can't really help you out here. Like SGaist says, just read the docs and you figure it out. Otherwise give us a piece of code to interface with. What kind of C++ class/object do you use/create etc. Now it's just guessing for us what you need.
    People are happy to help on this forum, so give us something to help you with.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.