I've been reading the doc. for the QProcess class and I've been trying different things.
Now I have like this in my .cpp file:
first the include for the class
#include <qprocess.h>
then the place where I want that the results appear:
te_results
= new QTextEdit( this,
"te_results" );
te_results
->setGeometry
( QRect( 250,
180,
341,
281 ) );
then the connection with the function scan():
connect( pb_scan, SIGNAL( clicked() ), this, SLOT( scan() ) );
pb_scan is the name of the button
and finally the function scan():
void BTScanning::scan()
{
process->addArgument("hcitool scan");
exit->readAllStadardOutput();
process->start();
}
#include <qprocess.h>
then the place where I want that the results appear:
te_results = new QTextEdit( this, "te_results" );
te_results->setGeometry( QRect( 250, 180, 341, 281 ) );
then the connection with the function scan():
connect( pb_scan, SIGNAL( clicked() ), this, SLOT( scan() ) );
pb_scan is the name of the button
and finally the function scan():
void BTScanning::scan()
{
QProcess *process = new QProcess(this);
QByteArray exit;
process->addArgument("hcitool scan");
exit->readAllStadardOutput();
process->start();
}
To copy to clipboard, switch view to plain text mode
But It appears one error like this when I'm trying to compile the project:
btscanning.cpp: In member function ‘virtual void BTScanning::scan()’:
btscanning.cpp:90: error: base operand of ‘->’ has non-pointer type ‘QByteArray’
I tried a lot of different things:
exit = process->start("hcitool scan");
connect(process, SIGNAL((hcitool scan)), this, SLOT("te_results"));
but nothings works...can you please help me. What I'm doing wrong? Thank you.
Bookmarks