MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
#ifdef TRACE
std::cout <<"TRACE START MainWindow Constructor File "<< __FILE__ << " Function " <<__FUNCTION__<<" @line "<< __LINE__<< std::endl;
#endif
BT_FormDeviceInquiry *deviceIquiry = new BT_FormDeviceInquiry();
if(connect(deviceIquiry,
SIGNAL(sendStatus
(QString)),
this,
SLOT(displayStatusMessage
(QString)))) std::cout <<"SUCCESS SIGNALS / SLOTS CONNECTED "<< std::endl;
else
{
std::cout <<"******************************************************FAILED CONNECTION " <<std::endl;
exit(-1);
}
#ifdef TRACE
std::cout <<"TRACE END MainWindow Constructor File "<< __FILE__ << " Function " <<__FUNCTION__<<" @line "<< __LINE__<< std::endl;
#endif
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
#ifdef TRACE
std::cout <<"TRACE START MainWindow Constructor File "<< __FILE__ << " Function " <<__FUNCTION__<<" @line "<< __LINE__<< std::endl;
#endif
BT_FormDeviceInquiry *deviceIquiry = new BT_FormDeviceInquiry();
if(connect(deviceIquiry,SIGNAL(sendStatus(QString)),this,SLOT(displayStatusMessage(QString))))
std::cout <<"SUCCESS SIGNALS / SLOTS CONNECTED "<< std::endl;
else
{
std::cout <<"******************************************************FAILED CONNECTION " <<std::endl;
exit(-1);
}
#ifdef TRACE
std::cout <<"TRACE END MainWindow Constructor File "<< __FILE__ << " Function " <<__FUNCTION__<<" @line "<< __LINE__<< std::endl;
#endif
}
To copy to clipboard, switch view to plain text mode
Does not get called
void MainWindow
::displayStatusMessage( const QString & message
) {
#ifdef TRACE
std::cout <<"TRACE \nFile "<< __FILE__ << "\nFunction " <<__FUNCTION__<<" \n@line "<< __LINE__<< std::endl;
#endif
/*
QStatusBar * pStatusBar = statusBar();
pStatusBar->showMessage( message, 5000 ); // A 5 second timeout
*/
ui->statusbar->showMessage(message,5000);
}
void MainWindow::displayStatusMessage( const QString & message )
{
#ifdef TRACE
std::cout <<"TRACE \nFile "<< __FILE__ << "\nFunction " <<__FUNCTION__<<" \n@line "<< __LINE__<< std::endl;
#endif
/*
QStatusBar * pStatusBar = statusBar();
pStatusBar->showMessage( message, 5000 ); // A 5 second timeout
*/
ui->statusbar->showMessage(message,5000);
}
To copy to clipboard, switch view to plain text mode
slot declaration in MainWIndow
int WriteStatus
(const QString *message
);
// int WriteStatus(char *message);
public slots:
void displayStatusMessage
( const QString & message
);
int WriteStatus(const QString *message);
// int WriteStatus(char *message);
public slots:
void displayStatusMessage( const QString & message );
To copy to clipboard, switch view to plain text mode
emit signal - using TRACE to verify execution
void BT_FormDeviceInquiry::scanFinished()
{
#ifdef TRACE
std::cout <<"TRACE \nFunction "<< __FUNCTION__ << "\nFile " << __FILE__<< "\n@Line # "<< __LINE__<< std::endl;
#endif
#ifdef BYPASS
CurrentTime();
QString text
= "STATE start scan for near-by BT devices finished ";
StatusBar(&text);
#endif
ui->scan->setEnabled(true); // TODO does not re_enable button
// test signal
#ifdef TRACE
std::cout <<"TRACE START emit sendStatus \nFunction "<< __FUNCTION__ << "\nFile " << __FILE__<< "\n@Line # "<< __LINE__<< std::endl;
#endif
emit sendStatus( "Status from SomeMethod" );
#ifdef TRACE
std::cout <<"TRACE END emit sendStatus \nFunction "<< __FUNCTION__ << "\nFile " << __FILE__<< "\n@Line # "<< __LINE__<< std::endl;
#endif
}
void BT_FormDeviceInquiry::scanFinished()
{
#ifdef TRACE
std::cout <<"TRACE \nFunction "<< __FUNCTION__ << "\nFile " << __FILE__<< "\n@Line # "<< __LINE__<< std::endl;
#endif
#ifdef BYPASS
CurrentTime();
QString text = "STATE start scan for near-by BT devices finished ";
StatusBar(&text);
#endif
ui->scan->setEnabled(true); // TODO does not re_enable button
// test signal
#ifdef TRACE
std::cout <<"TRACE START emit sendStatus \nFunction "<< __FUNCTION__ << "\nFile " << __FILE__<< "\n@Line # "<< __LINE__<< std::endl;
#endif
emit sendStatus( "Status from SomeMethod" );
#ifdef TRACE
std::cout <<"TRACE END emit sendStatus \nFunction "<< __FUNCTION__ << "\nFile " << __FILE__<< "\n@Line # "<< __LINE__<< std::endl;
#endif
}
To copy to clipboard, switch view to plain text mode
declaration of signal
public:
// 82920202
int TestFunction();
// declare signal
signals:
void sendStatus
( const QString & status
);
// CCC chnaged to publick private:
public:
QBluetoothDeviceDiscoveryAgent *discoveryAgent;
QBluetoothLocalDevice *localDevice;
Ui_DeviceDiscovery *ui;
public:
// 82920202
int TestFunction();
// declare signal
signals:
void sendStatus( const QString & status );
// CCC chnaged to publick private:
public:
QBluetoothDeviceDiscoveryAgent *discoveryAgent;
QBluetoothLocalDevice *localDevice;
Ui_DeviceDiscovery *ui;
To copy to clipboard, switch view to plain text mode
Bookmarks