There's a fine example in the docs ( and online here ).
Here's an example (not a 100% working example):
in the header:
#include <QtGui>
{
Q_OBJECT
public:
MyClass::MyClass();
MyClass::~MyClass();
signals:
void mySig();
public slots:
void mySlot();
};
#include <QtGui>
class MyClass : public QWidget
{
Q_OBJECT
public:
MyClass::MyClass();
MyClass::~MyClass();
signals:
void mySig();
public slots:
void mySlot();
};
To copy to clipboard, switch view to plain text mode
and the cpp file:
#include "myclass.h"
MyClass::MyClass() {
.....
connect (this, SIGNAL(mySig()), this, SLOT(mySlot());
.....
if (something) { emit mySig(); }
}
MyClass::~MyClass()
{
}
void MyClass::MySlot()
{
.....
doSomething();
.....
}
#include "myclass.h"
MyClass::MyClass() {
.....
connect (this, SIGNAL(mySig()), this, SLOT(mySlot());
.....
if (something) { emit mySig(); }
}
MyClass::~MyClass()
{
}
void MyClass::MySlot()
{
.....
doSomething();
.....
}
To copy to clipboard, switch view to plain text mode
Bookmarks