'\" t
.TH QSignal 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QSignal \- Can be used to send signals for classes that don't inherit QObject
.SH SYNOPSIS
\fC#include <ntqsignal.h>\fR
.PP
Inherits QObject.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQSignal\fR ( QObject * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QSignal\fR ()"
.br
.ti -1c
.BI "bool \fBconnect\fR ( const QObject * receiver, const char * member )"
.br
.ti -1c
.BI "bool \fBdisconnect\fR ( const QObject * receiver, const char * member = 0 )"
.br
.ti -1c
.BI "void \fBactivate\fR ()"
.br
.ti -1c
.BI "bool isBlocked () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void block ( bool b ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setParameter ( int value ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "int parameter () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void \fBsetValue\fR ( const QVariant & value )"
.br
.ti -1c
.BI "QVariant \fBvalue\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QSignal class can be used to send signals for classes that don't inherit QObject.
.PP
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.
.PP
In general, we recommend inheriting QObject instead. QObject provides much more functionality.
.PP
You can set a single QVariant parameter for the signal with setValue().
.PP
Note that QObject is a \fIprivate\fR base class of QSignal, i.e. you cannot call any QObject member functions from a QSignal object.
.PP
Example:
.PP
.nf
.br
#include <ntqsignal.h>
.br
.br
class MyClass
.br
{
.br
public:
.br
MyClass();
.br
~MyClass();
.br
.br
void doSomething();
.br
.br
void connect( QObject *receiver, const char *member );
.br
.br
private:
.br
QSignal *sig;
.br
};
.br
.br
MyClass::MyClass()
.br
{
.br
sig = new QSignal;
.br
}
.br
.br
MyClass::~MyClass()
.br
{
.br
delete sig;
.br
}
.br
.br
void MyClass::doSomething()
.br
{
.br
// ... does something
.br
sig->activate(); // emits the signal
.br
}
.br
.br
void MyClass::connect( QObject *receiver, const char *member )
.br
{
.br
sig->connect( receiver, member );
.br
}
.br
.fi
.PP
See also Input/Output and Networking and Miscellaneous Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QSignal::QSignal ( QObject * parent = 0, const char * name = 0 )"
Constructs a signal object called \fIname\fR, with the parent object \fIparent\fR. These arguments are passed directly to QObject.
.SH "QSignal::~QSignal ()"
Destroys the signal. All connections are removed, as is the case with all QObjects.
.SH "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.
.SH "void QSignal::block ( bool b )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Blocks the signal if \fIb\fR is TRUE, or unblocks the signal if \fIb\fR is FALSE.
.PP
An activated signal disappears into hyperspace if it is blocked.
.PP
See also isBlocked(), activate(), and QObject::blockSignals().
.SH "bool QSignal::connect ( const QObject * receiver, const char * member )"
Connects the signal to \fImember\fR in object \fIreceiver\fR.
.PP
See also disconnect() and QObject::connect().
.SH "bool QSignal::disconnect ( const QObject * receiver, const char * member = 0 )"
Disonnects the signal from \fImember\fR in object \fIreceiver\fR.
.PP
See also connect() and QObject::disconnect().
.SH "bool QSignal::isBlocked () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns TRUE if the signal is blocked, or FALSE if it is not blocked.
.PP
The signal is not blocked by default.
.PP
See also block() and QObject::signalsBlocked().
.SH "int QSignal::parameter () const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "void QSignal::setParameter ( int value )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "void QSignal::setValue ( const QVariant & value )"
Sets the signal's parameter to \fIvalue\fR
.SH "QVariant QSignal::value () const"
Returns the signal's parameter
.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqsignal.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qsignal.3qt) and the Qt
version (3.3.8).