Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Qt Q_OBJECT

 

Q_OBJECT is a Qt macro that every class derived from QObject that uses signals and slots must have in its declaration.

 

 

 

 

 

emitter.h

 

#ifndef EMITTER_H
#define EMITTER_H

#include <QObject>

struct Emitter : public QObject
{
  Q_OBJECT
  public:
    void emit_ok();
  signals:
    void ok();
};

#endif // EMITTER_H

 

 

 

 

 

emitter.cpp

 

#include <iostream>
#include "emitter.h"

void Emitter::emit_ok()
{
  std::clog << "Emitting\n";
  emit ok();
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict