Ok, I know that what i put here yesterday doesn't have any sense. After reading the QProcess, I can see that I did wrong from the beginning, isn't It?
I created the .ui file using QTDesigner and then, using uic command I created the header and the .cpp files from that .ui file.
After that I created the main.cpp and It worked perfectly but I started to have problems when I tried that the buttons of the GUI do something.
So I don't have to do my project like I did? I dont have to create the .cpp and .h files?
I'm completely lost I really need your help.....
I'm doing other things. Now I'm creating the new QPocess object into the BTScanning function like this:
BTScanning::BTScanning( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
QProcess *process = new QProcess(this);
then I creat the textEdit:
te_results = new QTextEdit( this, "te_results" );
te_results->setGeometry( QRect( 250, 180, 341, 281 ) );
the button:
pb_save = new QPushButton( Menu, "pb_save" );
pb_save->setGeometry( QRect( 40, 100, 112, 24 ) );
and I connect the button with the slot:
connect( pb_scan, SIGNAL( clicked() ), this, SLOT( scan() ) );
and scan() function is like this:
void BTScanning::scan()
{
QByteArray exit;
process->addArgument("hcitool scan");
exit = process->readStdout();
te_results->insertParagraph(QString(exit),-1);
}
and it appears the error:
btscanning.cpp: In constructor ‘BTScanning::BTScanning(QWidget*, const char*, uint)’:
btscanning.cpp:35: warning: unused variable ‘process’
btscanning.cpp: In member function ‘virtual void BTScanning::scan()’:
btscanning.cpp:97: error: ‘process’ was not declared in this scope
the problem is that if I solve It, If I put the lines:
QByteArray exit;
process->addArgument("hcitool scan");
exit = process->readStdout();
out of the scan() function, into the BTScanning function, and let the scan() function like this:
void BTScanning::scan()
{
te_results->insertParagraph(QString(exit),-1);
}
it appears this error:
btscanning.cpp:100: error: no matching function for call to ‘QString::QString(<unresolved overloaded function type>)’
/usr/include/qt3/qstring.h:746: note: candidates are: QString::QString(QStringData*, bool)
/usr/include/qt3/qstring.h:720: note: QString::QString(int, bool)
/usr/include/qt3/qstring.h:409: note: QString::QString(const std::string&)
/usr/include/qt3/qstring.h:406: note: QString::QString(const char*)
/usr/include/qt3/qstring.h:404: note: QString::QString(const QChar*, uint)
/usr/include/qt3/qstring.h:403: note: QString::QString(const QByteArray&)
/usr/include/qt3/qstring.h:402: note: QString::QString(const QString&)
/usr/include/qt3/qstring.h:401: note: QString::QString(QChar)
/usr/include/qt3/qstring.h:838: note: QString::QString()
but if I do this:
te_results->insertParagraph(QString("exit"),-1);
every time I press the button it appears in the textEdit area the word "exit".
I think that I'm not making any difference between all buttons of the menu.
How I have to do this difference? Each button has to do a different action, but If I create the object process into the BTScanning function I'm not doing this difference....
Bookmarks