Q3Signal Class ReferenceThe Q3Signal class can be used to send signals for classes that don't inherit QObject. More... #include <Q3Signal> This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information. Inherits: QObject. Public Functions
Additional Inherited Members
Detailed DescriptionThe Q3Signal class can be used to send signals for classes that don't inherit QObject. If you want to send signals from a class that does not inherit QObject, you can create an internal Q3Signal object to emit the signal. You must also provide a function that connects the signal to an outside object slot. This is how we used to implement signals in Qt 3's QMenuData class, which was not a QObject. In Qt 4, menus contain actions, which are QObjects. In general, we recommend inheriting QObject instead. QObject provides much more functionality. You can set a single QVariant parameter for the signal with setValue(). Note that QObject is a private base class of Q3Signal, i.e. you cannot call any QObject member functions from a Q3Signal object. Example: #include <q3signal.h> class MyClass { public: MyClass(); ~MyClass(); void doSomething(); void connect(QObject *receiver, const char *member); private: Q3Signal *sig; }; MyClass::MyClass() { sig = new Q3Signal; } MyClass::~MyClass() { delete sig; } void MyClass::doSomething() { // ... does something sig->activate(); // emits the signal } void MyClass::connect(QObject *receiver, const char *member) { sig->connect(receiver, member); } Member Function Documentation
|