Very basic deployment questions
-
Very new to qt so please excuse my ignorance.
I already have a console command line program which i want to port to a ui.
The console program will either run on ubuntu server/ red hat linux without a graphical interface.
The basic idea I formed after some research was to use a client server model like fortune example.
I tried to deploy the fortune server to my ubuntu server but it failed with libQt5widgets.so dependency.So first question is, do I need to install qt on all systems I intend to run programs on? I was under the impression that I could deploy them prepackaged once developed.
second, even after hours of googling and going through docs, I didn't find a way to deploy qt libraries etc. to non X server systems like ubuntu server and red hat. What libraries will i need to install on each system assuming I don't need ui components. I already have qt creator installed on my dev system.
Thirdly, Is there an option of creating a remote ui kind of setup where my code runs on the remote machine without ui but ui gets rendered on a client machine which can be windows/ ubuntu 12.04 standard desktop. This might be just me daydreaming but if possible this could avoid me a lot of event handling etc.
Finally for this scenario where I only want ui on the client machine which fires basic calls etc, what should i look into qtTcpsocket or event slot and listen?
-
Hi and welcome to devnet,
Since you are probably not using any widget, edit your pro file and look for something like
@QT += widgets@Remove that line, so the dependency will be dropped.
You don't need to install all the libraries, you can package your application with only what your application needs. Look "here":http://qt-project.org/doc/qt-5/linux-deployment.html for instructions.
You only need to provide what your application is needing. c.f. the link above.
It's a typical client/server implementation. You an e.g. expose a web service that will control you command line application or build your own server like the fortune example.
Hope it helps
-
Thanks Sgaist,
When I removed QT += widgets, it started giving me all sorts of error in server.cpp and server.h with all Qt files like Qtdialog etc. don't think it's as straightforward as that or am i not understanding something very basic. Granted it's been more than 8 hours on this issue for me.
The web service thought has crossed my mind more than once. Only question is if I have to go that route why not drop Qt alltogether and use something like cgi etc though I am inclined to learn Qt for long term benefits. -
Well, if you are using widget related stuff in your server code the your can't drop the dependency. Since the code is meant to be command line only (if I understood your correctly) then don't put any widgets in there. Make a separate application that knows how to talk to your cli application.
You an also write it in Qt ;-)
But it is up to you. Use the tool that is best suited for your needs :-) -
Yes, it's possible, take a loot at the Qt Cloud Services
-
Indeed, it's a new service Digia is offering.
Yes they can, but you need to deploy the thing properly using e.g. the offscreen plugin. The real question here is: does make sense to have the GUI builtin that server software or should it rather be a pure CLI where you provide a secondary GUI software that uses that CLI ?
-
Thanks Sgaist,
My plan is to have two softwares only. One a pure cli which is run on server side and a command ui which communicates with the CLI.
I want gui to be able to just start stop the cli and retrieve some data from cli when needed.
Also, want to be able to see all the std output from cli on the gui side. -
Then QProcess is your friend
-
SGaist,
I was trying to play around with QProcess. I built a ui with widgets and added just one button. on button click I added a Qprocess code to start a precompiled c++ executable. Here it is. But when I click the button it fails and crashes. I picked the code from QProcess page on the site itself.@
void MainWindow::on_startButton_clicked()
{
QObject * parent;
QString program = "./path/exec";
QStringList arguments;
arguments << "";QProcess *myProcess = new QProcess(parent); myProcess->start(program, arguments);
}
@[edit: added missing coding tags @ SGaist]
-
I changed the code in click function to below.
Now it doesn't give any errors but still I don't see any result files generated by the execution@
QString program = "./path/exec";
QProcess *myProcess = new QProcess(this);
myProcess->start(program);
@[edit: added missing coding tags @ SGaist]
-
In you first example parent is not initialized hence the crash.
"./path/exec" is a relative path to the current path. You should rather give the fullpath to exec.