File: exampleclass.cpp

package info (click to toggle)
libsigc%2B%2B-3.0 3.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,352 kB
  • sloc: cpp: 6,829; xml: 347; makefile: 197; python: 148; sh: 73
file content (34 lines) | stat: -rw-r--r-- 811 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <QCoreApplication>

#include "exampleclass.h"

ExampleClass::ExampleClass(QObject *parent) :
    QObject(parent)
{
    /* Create a slot from our example_slot method. */
    m_sigc_slot = sigc::mem_fun( *this, &ExampleClass::example_slot );

    /* Connect our sigc++ signal to our sigc++ slot */
    m_sigc_signal.connect( m_sigc_slot );

    /* Emit a sigc++ signal */
    m_sigc_signal.emit();

    /* Connect the Qt signal to our Qt slot */
    connect( &m_timer, &QTimer::timeout,
             this, &ExampleClass::timer_slot );
    m_timer.start( 200 );

    /* Emit a Qt signal */
    Q_EMIT example_signal();
}

void ExampleClass::timer_slot(){
    qDebug() << "Timer slot called";

    QCoreApplication::exit( 0 );
}

void ExampleClass::example_slot(){
    qDebug() << "Example slot called";
}