📄 qsignal.3qt
字号:
'\" t.TH QSignal 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQSignal \- Can be used to send signals for classes that don't inherit QObject.PP\fC#include <qsignal.h>\fR.PPInherits 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 DESCRIPTIONThe QSignal class can be used to send signals for classes that don't inherit QObject..PPIf 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..PPIn general, we recommend inheriting QObject instead. QObject provides much more functionality..PPYou can set a single QVariant parameter for the signal with setValue()..PPNote that QObject is a \fIprivate\fR base class of QSignal, i.e. you cannot call any QObject member functions from a QSignal object..PPExample:.PP.nf.br #include <qsignal.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.PPSee 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 with the parent object \fIparent\fR and a \fIname\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..PPBlocks the signal if \fIb\fR is TRUE, or unblocks the signal if \fIb\fR is FALSE..PPAn activated signal disappears into hyperspace if it is blocked..PPSee 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..PPSee 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..PPSee 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..PPReturns TRUE if the signal is blocked, or FALSE if it is not blocked..PPThe signal is not blocked by default..PPSee 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/qsignal.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf 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..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf 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 Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -