Run 2nd program from Qt and send constantly infromation from 2nd program to Qt.



  • Hello all,

    I have a really big simulator and i need to create a gui for a part it(run it from command line and i direct simulator through arguments)

    I cant extract that small part of from the whole simulator and i cant create gui on top of it(i guess). So i chose to make a seperate Gui through Qt and then run the application within Qt with the given arguements(take from gui) But how i cant constantly take infrormation from the application run in terminal?(Visualize Internetwork simulator - i need to know every cycle where is each flit/packet)

    I did something like this with threads and sockets but with 2 command line programs.
    What options do i have ?

    Thank you in advance!!


  • Moderators

    @nnicou

    Hi and welcome to devnet forum

    You are probably already aware of the method to start an external application through QProcess

    This is certaily one way to start your simulator. If your simulator is only available as readily compiled executable, the only way would be to scan the outputs and extract the required information e.g. through signal readyReadStandardOutput.

    If you have access to the source of your simulator you can add for instance QTcpSocket/QTcpServer and communicate between your GUI app and the simulator. Or you can do also a mix of both.



  • Thank you alot for the advice. I have access to the source code and i guess i will need to use sockets to collect all the data i need and then forward it to my Gui App . The first option may not be helpful due to the fact that the data i need are not output but data from components of the simulator. that i need to extract


  • Moderators

    @nnicou

    For sure the first option is only possible when you have enough information output to cout and/or cerr. I have used this also and it works, but might be a bit crude.

    The option through TCP sockets allows more precision especially timewise, but this depends on a lot of different factors.



  • @koahnig Hmm i was thinking about precision but the good part of the simulator is event driven i hope this helps me if i go with sockets options and I hope this method will not add extra overhead to the simulation.

    Thank you alot and i will start working and see which option suits my demands.


Log in to reply
 

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