qsignal.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 183 行

HTML
183
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qsignal.cpp:42 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QSignal Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSignal Class Reference</h1><p>The QSignal class can be used to send signals for classesthat don't inherit QObject.<a href="#details">More...</a><p><tt>#include &lt;<a href="qsignal-h.html">qsignal.h</a>&gt;</tt><p>Inherits <a href="qobject.html">QObject</a>.<p><a href="qsignal-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QSignal"><b>QSignal</b></a> ( QObject&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn><a href="#~QSignal"><b>~QSignal</b></a> ()</div></li><li><div class=fn>bool <a href="#connect"><b>connect</b></a> ( const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member )</div></li><li><div class=fn>bool <a href="#disconnect"><b>disconnect</b></a> ( const&nbsp;QObject&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member = 0 )</div></li><li><div class=fn>void <a href="#activate"><b>activate</b></a> ()</div></li><li><div class=fn>bool isBlocked () const &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>void block ( bool&nbsp;b ) &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>void setParameter ( int&nbsp;value ) &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>int parameter () const &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>void <a href="#setValue"><b>setValue</b></a> ( const&nbsp;QVariant&nbsp;&amp;&nbsp;value )</div></li><li><div class=fn>QVariant <a href="#value"><b>value</b></a> () const</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QSignal class can be used to send signals for classesthat don't inherit <a href="qobject.html">QObject</a>.<p> <p> If you want to send signals from a class that does not inheritQObject, you can create an internal QSignal object to emit thesignal. You must also provide a function that connects the signalto an outside object slot.  This is how we have implementedsignals in the <a href="qmenudata.html">QMenuData</a> class, which is not a QObject.<p> In general, we recommend inheriting QObject instead. QObjectprovides much more functionality.<p> You can set a single <a href="qvariant.html">QVariant</a> parameter for the signal with<a href="#setValue">setValue</a>().<p> Note that QObject is a <em>private</em> base class of QSignal, i.e. youcannot call any QObject member functions from a QSignal object.<p> Example:<pre>        #include &lt;<a href="qsignal-h.html">qsignal.h</a>&gt;        class MyClass        {        public:            MyClass();            ~MyClass();            void doSomething();            void connect( <a href="qobject.html">QObject</a> *receiver, const char *member );        private:            QSignal *sig;        };        MyClass::MyClass()        {            sig = new QSignal;        }        MyClass::~MyClass()        {            delete sig;        }        void MyClass::doSomething()        {            // ... does something            sig-&gt;<a href="#activate">activate</a>(); // emits the signal        }        void MyClass::connect( <a href="qobject.html">QObject</a> *receiver, const char *member )        {            sig-&gt;<a href="#connect">connect</a>( receiver, member );        }    </pre> <p>See also <a href="io.html">Input/Output and Networking</a> and <a href="misc.html">Miscellaneous Classes</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QSignal"></a>QSignal::QSignal ( <a href="qobject.html">QObject</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</h3>Constructs a signal object called <em>name</em>, with the parent object<em>parent</em>. These arguments are passed directly to <a href="qobject.html">QObject</a>.<h3 class=fn><a name="~QSignal"></a>QSignal::~QSignal ()</h3>Destroys the signal. All connections are removed, as is the casewith all QObjects.<h3 class=fn>void <a name="activate"></a>QSignal::activate ()</h3><p> Emits the signal. If the platform supports <a href="qvariant.html">QVariant</a> and aparameter has been set with <a href="#setValue">setValue</a>(), this value is passed inthe signal.<h3 class=fn>void <a name="block"></a>QSignal::block ( bool&nbsp;b )</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> Blocks the signal if <em>b</em> is TRUE, or unblocks the signal if <em>b</em> is FALSE.<p> An activated signal disappears into hyperspace if it is blocked.<p> <p>See also <a href="#isBlocked">isBlocked</a>(), <a href="#activate">activate</a>() and <a href="qobject.html#blockSignals">QObject::blockSignals</a>().<h3 class=fn>bool <a name="connect"></a>QSignal::connect ( const&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member )</h3>Connects the signal to <em>member</em> in object <em>receiver</em>.<p> <p>See also <a href="#disconnect">disconnect</a>() and <a href="qobject.html#connect">QObject::connect</a>().<h3 class=fn>bool <a name="disconnect"></a>QSignal::disconnect ( const&nbsp;<a href="qobject.html">QObject</a>&nbsp;*&nbsp;receiver, const&nbsp;char&nbsp;*&nbsp;member = 0 )</h3>Disonnects the signal from <em>member</em> in object <em>receiver</em>.<p> <p>See also <a href="#connect">connect</a>() and <a href="qobject.html#disconnect">QObject::disconnect</a>().<h3 class=fn>bool <a name="isBlocked"></a>QSignal::isBlocked () const</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> Returns TRUE if the signal is blocked, or FALSE if it is not blocked.<p> The signal is not blocked by default.<p> <p>See also <a href="#block">block</a>() and <a href="qobject.html#signalsBlocked">QObject::signalsBlocked</a>().<h3 class=fn>int <a name="parameter"></a>QSignal::parameter () const</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<h3 class=fn>void <a name="setParameter"></a>QSignal::setParameter ( int&nbsp;value )</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<h3 class=fn>void <a name="setValue"></a>QSignal::setValue ( const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;value )</h3>Sets the signal's parameter to <em>value</em><h3 class=fn><a href="qvariant.html">QVariant</a> <a name="value"></a>QSignal::value () const</h3>Returns the signal's parameter<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright &copy; 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?