Is it possible to have existing C++ code work with

2019-08-29 07:47发布

I am new here. I am a beginner in Qt but i am an intermediate level programmer in c++. I had written a program previously in C++ and STL(No code is platform dependent and whole program is broken into around ten .cpp/.h files). Now if I develop A Gui in qt,can I link it to my old program or should I rewrite everything? For instance I use file IO using fstream. But in Qt I see there is QFile so is it possible to link it. The program is pretty lengthy. So it will be very hard to rewrite everything. Gui is not mandatory for me but I thought it would be good for presentation.It is for my Project so please reply soon.Please give me some examples or sites to refer to if possible. Thank you in Advance... Manish

标签: c++ qt qt4
1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-29 08:14

You can write a Qt GUI for your program:

One option is to create a separate program with GUI that starts your program as a subprocess, using QProcess. The GUI program will send command line parameters and you can communicate with it.

Another option is to rewrite the main of your program so that it is another function. You can get your GUI program to call the function.

There is no need to use QFile or other parts of Qt unless you want to rewrite that part of your program or use a feature of Qt.

查看更多
登录 后发表回答