Lumbricus
17th May 2016, 19:54
Hey guys,
i'm making a program with a gui, due to ram and cpu specifications i need to put this program on a cluster and run it there. I cannot get gui support from the server through vpn. So im trying to make my app work as a gui or as a commandline program.
I can start the program from command line with the command(this is on linux):
"./imex" -> with gui
"./imex -nogui" -> withought gui
the thing im interested in, is the final if{nogui==false} below, why does my gui not show up on my testmachine if i run the ./imex command, if i dont run the nogui check ( the if {nogui==false} it will run fine).
#include "mainwindow.h"
#include <QApplication>
#include "imex.h"
#include <SpiceUsr.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qDebug() << "";
//start with gui if not specified
bool nogui=false;
//check input arguments
for (int i=1; i<argc; i++)
{
if( strncmp(argv[i], "-nogui", 9) == 0)
{
nogui=true;
//no gui support
imex guidata;
qDebug() << "Input kernel location";
QTextStream s(stdin);
guidata.filepath_metakernel = s.readLine();
qDebug() << "Path is: " << guidata.filepath_metakernel;
QByteArray ba;
const char *c_str;
//QString -> C-String
ba = guidata.filepath_metakernel.toUtf8();
c_str = ba.data();
furnsh_c(c_str);
qDebug() << "No consol, not implemented";
qDebug() << "";
}
}
if(nogui == false)
{
qDebug() << "running gui";
//run gui
MainWindow w;
w.show();
}
return a.exec();
}
can someone explain what happens with the gui if i put the mainwWindow w; w.show(); in the if-brackets?
i'm making a program with a gui, due to ram and cpu specifications i need to put this program on a cluster and run it there. I cannot get gui support from the server through vpn. So im trying to make my app work as a gui or as a commandline program.
I can start the program from command line with the command(this is on linux):
"./imex" -> with gui
"./imex -nogui" -> withought gui
the thing im interested in, is the final if{nogui==false} below, why does my gui not show up on my testmachine if i run the ./imex command, if i dont run the nogui check ( the if {nogui==false} it will run fine).
#include "mainwindow.h"
#include <QApplication>
#include "imex.h"
#include <SpiceUsr.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qDebug() << "";
//start with gui if not specified
bool nogui=false;
//check input arguments
for (int i=1; i<argc; i++)
{
if( strncmp(argv[i], "-nogui", 9) == 0)
{
nogui=true;
//no gui support
imex guidata;
qDebug() << "Input kernel location";
QTextStream s(stdin);
guidata.filepath_metakernel = s.readLine();
qDebug() << "Path is: " << guidata.filepath_metakernel;
QByteArray ba;
const char *c_str;
//QString -> C-String
ba = guidata.filepath_metakernel.toUtf8();
c_str = ba.data();
furnsh_c(c_str);
qDebug() << "No consol, not implemented";
qDebug() << "";
}
}
if(nogui == false)
{
qDebug() << "running gui";
//run gui
MainWindow w;
w.show();
}
return a.exec();
}
can someone explain what happens with the gui if i put the mainwWindow w; w.show(); in the if-brackets?