1 #include <QCoreApplication>
2 
3 #include "exampleclass.h"
4 
ExampleClass(QObject * parent)5 ExampleClass::ExampleClass(QObject *parent) :
6     QObject(parent)
7 {
8     /* Create a slot from our example_slot method. */
9     m_sigc_slot = sigc::mem_fun( *this, &ExampleClass::example_slot );
10 
11     /* Connect our sigc++ signal to our sigc++ slot */
12     m_sigc_signal.connect( m_sigc_slot );
13 
14     /* Emit a sigc++ signal */
15     m_sigc_signal.emit();
16 
17     /* Connect the Qt signal to our Qt slot */
18     connect( &m_timer, &QTimer::timeout,
19              this, &ExampleClass::timer_slot );
20     m_timer.start( 200 );
21 
22     /* Emit a Qt signal */
23     Q_EMIT example_signal();
24 }
25 
timer_slot()26 void ExampleClass::timer_slot(){
27     qDebug() << "Timer slot called";
28 
29     QCoreApplication::exit( 0 );
30 }
31 
example_slot()32 void ExampleClass::example_slot(){
33     qDebug() << "Example slot called";
34 }
35