Eneboo - Documentación para desarrolladores
|
The QSignal class can be used to send signals for classes that don't inherit QObject. Más...
#include <qsignal.h>
Señales | |
void | signal (const QVariant &) |
void | intSignal (int) |
void | signal (const QVariant &) |
void | intSignal (int) |
Métodos públicos | |
QSignal (QObject *parent=0, const char *name=0) | |
~QSignal () | |
bool | connect (const QObject *receiver, const char *member) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | activate () |
bool | isBlocked () const |
void | block (bool b) |
void | setParameter (int value) |
int | parameter () const |
void | setValue (const QVariant &value) |
QVariant | value () const |
QSignal (QObject *parent=0, const char *name=0) | |
~QSignal () | |
bool | connect (const QObject *receiver, const char *member) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | activate () |
bool | isBlocked () const |
void | block (bool b) |
void | setParameter (int value) |
int | parameter () const |
void | setValue (const QVariant &value) |
QVariant | value () const |
The QSignal 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 QSignal object to emit the signal. You must also provide a function that connects the signal to an outside object slot. This is how we have implemented signals in the QMenuData class, which is not a QObject.
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 QSignal, i.e. you cannot call any QObject member functions from a QSignal object.
Example:
#include <qsignal.h> class MyClass { public: MyClass(); ~MyClass(); void doSomething(); void connect( QObject *receiver, const char *member ); private: QSignal *sig; }; MyClass::MyClass() { sig = new QSignal; } 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 ); }
QSignal::QSignal | ( | QObject * | parent = 0 , |
const char * | name = 0 |
||
) |
Constructs a signal object called name, with the parent object parent. These arguments are passed directly to QObject.
QSignal::~QSignal | ( | ) |
Destroys the signal. All connections are removed, as is the case with all QObjects.
QSignal::QSignal | ( | QObject * | parent = 0 , |
const char * | name = 0 |
||
) |
QSignal::~QSignal | ( | ) |
void QSignal::activate | ( | ) |
Emits the signal. If the platform supports QVariant and a parameter has been set with setValue(), this value is passed in the signal.
void QSignal::activate | ( | ) |
void QSignal::block | ( | bool | b | ) | [inline] |
Blocks the signal if b is TRUE, or unblocks the signal if b is FALSE.
An activated signal disappears into hyperspace if it is blocked.
void QSignal::block | ( | bool | b | ) | [inline] |
Connects the signal to member in object receiver.
Disonnects the signal from member in object receiver.
Reimplementado de QObject.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Disconnects all signals in this object from receiver's member.
A signal-slot connection is removed when either of the objects involved are destroyed.
Reimplementado de QObject.
void QSignal::intSignal | ( | int | t0 | ) | [signal] |
void QSignal::intSignal | ( | int | ) | [signal] |
bool QSignal::isBlocked | ( | ) | const [inline] |
Returns TRUE if the signal is blocked, or FALSE if it is not blocked.
The signal is not blocked by default.
bool QSignal::isBlocked | ( | ) | const [inline] |
int QSignal::parameter | ( | ) | const |
int QSignal::parameter | ( | ) | const |
void QSignal::setParameter | ( | int | value | ) |
void QSignal::setParameter | ( | int | value | ) |
void QSignal::setValue | ( | const QVariant & | value | ) |
void QSignal::setValue | ( | const QVariant & | value | ) |
Sets the signal's parameter to value
void QSignal::signal | ( | const QVariant & | ) | [signal] |
void QSignal::signal | ( | const QVariant & | t0 | ) | [signal] |
QVariant QSignal::value | ( | ) | const |
QVariant QSignal::value | ( | ) | const |
Returns the signal's parameter