You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, February 18th 2012, 1:37pm

QProcess Problem with starting a Blender Runtime with Arguments

Hello,


what i want :

starting a blender runtime with resolution arguments

what i have done:
//// in header file


Source code

1
2
private slots:    void on_cmdExec_finish(int);      void on_cmdExec_data_available();      void disableButtons();      void init800x600(); 
 private:     Ui::StartWindow *ui;      QProcess ps;      QString output;



//// edit 20.2.20112 add the complete cpp

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "startwindow.h"
#include "ui_startwindow.h"
#include "QDebug"




StartWindow::StartWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::StartWindow)
{

    ui->setupUi(this);

    //////// connect signals
    ps.setProcessChannelMode(QProcess::MergedChannels);
    connect(&ps, SIGNAL(readyRead()), this, SLOT(on_cmdExec_data_available()));
    connect(&ps, SIGNAL(finished(int)), this, SLOT(on_cmdExec_finish(int)));
    ////////////////////////

    connect( ui->b800x600, SIGNAL( clicked() ), this, SLOT( init800x600() ) );
   // connect( ui->b1024x768, SIGNAL( clicked() ), this, SLOT( init1024x768() ) );
    //connect( ui->b1280x960, SIGNAL( clicked() ), this, SLOT( init1280x960() ) );
   // connect( ui->b1600x900, SIGNAL( clicked() ), this, SLOT( init1600x900() ) );
   // connect( ui->b1920x1080, SIGNAL( clicked() ), this, SLOT( initb1920x1080() ) );

}

StartWindow::~StartWindow()
{
    delete ui;
}


void StartWindow::on_cmdExec_finish(int) {
    ui->b800x600->setEnabled(true);
    ui->b1024x768->setEnabled(true);
    ui->b1280x960->setEnabled(true);
    ui->b1600x900->setEnabled(true);
    ui->b1920x1080->setEnabled(true);
}

void StartWindow::on_cmdExec_data_available() {
    output += ps.readAll() + "\n";
}

void StartWindow::disableButtons(){
    ui->b800x600->setDisabled(true);
    ui->b1024x768->setDisabled(true);
    ui->b1280x960->setDisabled(true);
    ui->b1600x900->setDisabled(true);
    ui->b1920x1080->setDisabled(true);
}

void StartWindow::init800x600(){

    disableButtons();

    //QString program = "";
    QStringList arguments;
    arguments << "-f" << "800" << "600"; 
 // -f means start fullscreen, want it with resolution 800x600 ... and some other (later i want to get them from settings file) 
    //output = "";
    //ps.start("64_n\\64_n.exe -f 800 600");


    QString programm = "64_n/64_n.exe";
    qDebug() << programm;
     ps.start(programm, arguments);

}




//// i tested also

Source code

1
 ps.start("64_n/64_n.exe -f 800 600"); 


//in my batch (start.bat) file it starts with no problems

Source code

1
64_n.exe -f 800 600
// it starts in fullscreen with resolution 800x600


Problem from my qtprog it starts sometimes fullscreen sometimes not but never i got them to start in right resolution :(



i load the 32bit version of my blender runtime (simple 3d room with some furniture) to my web

http://hunix.info/testfiles/32_n.zip




ps.: sorry for my english :rolleyes:

This post has been edited 4 times, last edit by "..k1.." (Feb 20th 2012, 10:33am)


2

Monday, February 20th 2012, 3:18pm

sorry for duplicate post, but nobody answers.

today i find a short way in pascal

Source code

1
Process1.CommandLine := '64_n/monky_test.exe -w 1024 768';
8)

but iam also interested in a solution with qprocess ?(

3

Monday, February 20th 2012, 5:07pm

why are you using -w in pascal, but -f in c++?

I don't know why it wont work - you said sometimes it goes fullscreen, sometimes not - so it's unlikely to be soley qprocess problem because that will pass the same arguments to the process every time.

I only ever had a problem with QProcess when I used \ in paths instead of /.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

This post has been edited 1 times, last edit by "Amleto" (Feb 20th 2012, 5:14pm)


4

Monday, February 20th 2012, 7:42pm

thank you for reply.

sorry have forgot to comment ... -w means windowed mode -f fullscreen


you said sometimes it goes fullscreen, sometimes not - so it's unlikely to be soley qprocess problem because that will pass the same arguments to the process every time


sorry my fault,
i mean if i am use -f or -w only they start windowed or fullscreen mode.
if i use it with the arguments method they do also start windowed or fullscreen mode, but it don't use the given resolution.
if i use the complete command line string they ignore all arguments, included -w and -f ps.start("64_n\\64_n.exe -f 800 600");


in pascal i use both -w and -f and different resolutions ... no problems occurred

This post has been edited 2 times, last edit by "..k1.." (Feb 20th 2012, 10:06pm)


5

Monday, February 20th 2012, 11:13pm

"64_n\\64_n.exe -f 800 600"


as I just said, qprocess doesnt like \ - only use /

Aside from that, I dont know.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar threads