Qt-interest Archive, March 2007
Using QProcess withput any widgets
Message 1 in thread
Hi,
Can u tell me where i am wrong ....
I want to use the QProcess method to create a subprocess and am not using
any widgets....
I have subclassed the class X with QObject as i need to subclass it with
QObject or any of its subcalsses to use Q_Object Macro
class X : public QObject
{
Q_OBJECT
public:
QProcess *proc;
X(QObject *parent, const cahr * name) : QObject(parent, name);
start();
public slots:
void readFromStdout();
void readFromStderr();
}
X::start()
{
proc = new QProcess();
proc->addArgument("ls");
proc->addArgument("-l");
proc->addArgument("-r");
proc->addArgument("-t");
connect(proc, SIGNAL(readyReadStdout()), this,
SLOT(readFromStdout()));
connect(proc, SIGNAL(readyReadStderr()), this,
SLOT(readFromStderr()));
//readFromStdout();
}
In Slots readFromStdout(), readFromStderr(), I am printing the output
If i call readFromStdout() directly [by giving a time sleep of 5 sec in
the method to get the output from proc] in start() method, it is printing
the output
Best Regards,
Hemanth
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
Message 2 in thread
Hi,
sorry for not mentioning the actual probelm in previous mail....
when i run the sample code it is not giving any output....
It is not going into the slots through CONNECT statement but when i
specifically call the SLOT in start() method it is printing output.
Best Regards,
Hemanth
Hi,
Can u tell me where i am wrong ....
I want to use the QProcess method to create a subprocess and am not using
any widgets....
I have subclassed the class X with QObject as i need to subclass it with
QObject or any of its subcalsses to use Q_Object Macro
class X : public QObject
{
Q_OBJECT
public:
QProcess *proc;
X(QObject *parent, const cahr * name) : QObject(parent, name);
start();
public slots:
void readFromStdout();
void readFromStderr();
}
X::start()
{
proc = new QProcess();
proc->addArgument("ls");
proc->addArgument("-l");
proc->addArgument("-r");
proc->addArgument("-t");
connect(proc, SIGNAL(readyReadStdout()), this,
SLOT(readFromStdout()));
connect(proc, SIGNAL(readyReadStderr()), this,
SLOT(readFromStderr()));
//readFromStdout();
}
In Slots readFromStdout(), readFromStderr(), I am printing the output
If i call readFromStdout() directly [by giving a time sleep of 5 sec in
the method to get the output from proc] in start() method, it is printing
the output
Best Regards,
Hemanth
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
ForwardSourceID:NT0000A43E
Message 3 in thread
Hi,
Where is you main() function? Is an event loop running?
--
[ signature omitted ]
Message 4 in thread
Hi,
My main() function just creates an object of X and calls start() method
.....
no code related to QApplication is present n so no event loops.... i just
want to use functionality of QProcess ....
Hemanth Kumar Nakkina
Tata Consultancy Services
Mailto: hemanth.n@xxxxxxx
Website: http://www.tcs.com
Dimitri <dimitri@xxxxxxxxxxxxx>
03/12/2007 05:24 PM
To
qt-interest@xxxxxxxxxxxxx
cc
Subject
Re: Using QProcess withput any widgets
Hi,
Where is you main() function? Is an event loop running?
--
[ signature omitted ]
Message 5 in thread
Hi,
> My main() function just creates an object of X and calls start() method
> ....
>
> no code related to QApplication is present n so no event loops.... i
> just want to use functionality of QProcess ....
As far as I can recall, QProcess uses functionality of QCoreApplication.
--
[ signature omitted ]