Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QSignal class can be used to send signals for classes that do not inherit QObject. More...
#include <QSignal>
The QSignal class can be used to send signals for classes that do not inherit QObject.
If you want to send signals from a class that does not inherit QObject, you can create an internal QSignal<T> object to emit the signal. T is the type of the signal's argument, and it can be void. You must also provide a function that connects the signal to an outside object slot.
In general, we recommend inheriting QObject instead, since QObject provides much more functionality.
Example:
#include <qsignal.h> class MyClass { public: MyClass(); ~MyClass(); void doSomething(); void connect(QObject *receiver, const char *member); private: QSignal<void> sig; }; void MyClass::doSomething() { // ... does something sig->activate(); // emits the signal } void MyClass::connect(QObject *receiver, const char *member) { sig->connect(receiver, member); }
Constructs a signal object
Destroys the signal. All connections are removed.
Emits the signal with value t.
Connects the signal to member in object receiver using the given connection type.
See also disconnect().
Disconnects the signal from member in object receiver.
See also connect().
Copyright © 2004 Trolltech. | Trademarks | Qt 4.0.0-tp1 |