index.lxp@lxpwrap=x9571_252ehtm.htm

来自「GUI Programming with Python」· HTM 代码 · 共 553 行

HTM
553
字号
    <table border="0" cellspacing="0" cellpadding="3" width="100%"><tr><td>    <div align="center" id="bldcontent">      <a href="../default.htm"><img src="../images/opendocs.png" width="63" height="76" border="0"></a>      <br>      <div class="symbol">Your OpenSource Publisher&#153;</div>    </div>      </td></tr></table>    <div align="center" class="author">      	<a href="../products.lxp">Products</a>	&nbsp;|&nbsp;	<a href="../wheretobuy.lxp">Where to buy</a>	&nbsp;|&nbsp;	<a href="../bookstore.lxp">Retailers</a>	&nbsp;|&nbsp;	<a href="../faq.lxp">FAQ</a>	&nbsp;|&nbsp;        <a href="../writeforus.lxp">Write for Us.</a>        &nbsp;|&nbsp;        <a href="#contact">Contact Us.</a>  </div>    <table border="0" cellspacing="3" cellpadding="0" width="100%"><tr><td width="100%">      <div class="content">        <table border="0" cellspacing="2" cellpadding="0" width="100%"><tr><td width="100%">          <div align="center"><H4 CLASS="AUTHOR"><A NAME="AEN5">Boudewijn Rempt</A><br><a href="../../https@secure.linuxports.com/opendocs/default.htm"><img src=odpyqt125.png></a><br>ISBN: 0-97003300-4-4<br><a href="../../https@secure.linuxports.com/opendocs/default.htm">Available from bookstores everywhere or you can order it here.</a><p>You can download the source files for the book <a href="pyqtsrc.tgz">(code / eps) here.</a><hr></div>                    <HTML><HEAD><TITLE>Accepted C++ / Qt constructs</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.72"><LINKREL="HOME"TITLE="GUI Programming with Python: QT Edition"HREF="book1.htm"><LINKREL="UP"TITLE="First Steps with Sip"HREF="a8834.htm"><LINKREL="PREVIOUS"TITLE="Directives"HREF="x9236.htm"><LINKREL="NEXT"TITLE="SIPLIB Functions"HREF="x9684.htm"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GUI Programming with Python: QT Edition</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><A accesskey="P" href="index.lxp@lxpwrap=x9236_252ehtm.htm">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Appendix C. First Steps with Sip</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><A accesskey="N" href="index.lxp@lxpwrap=x9684_252ehtm.htm">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1">Accepted C++ / Qt constructs</A></H1><P>The following constructs can be handled by      <BCLASS="COMMAND">sip</B>: typedef, struct, class, public,      protected, private, signals, slots, virtual, const, static,      void, bool, char, short, unsigned, int, long, float, double and      enum. There are some restrictions:</P><DIVCLASS="GLOSSLIST"><DL><DT><B>class</B></DT><DD><P><P></P><ULCOMPACT="COMPACT"><LI><SPAN> Class definition can not be                    nested. </SPAN></LI><LI><SPAN> A class must not have private                    abstract functions. </SPAN></LI><LI><SPAN> Constructor must be in the public,                    private or protected sections.                  </SPAN></LI><LI><SPAN> Function must be in the public,                    private, protected, slot or signal sections.                  </SPAN></LI><LI><SPAN> Class variables must be in the                    public section. </SPAN></LI><LI><SPAN> Class enums must be in the public                    or protected sections.                  </SPAN></LI></UL></P></A><BLOCKQUOTECLASS="BLOCKQUOTE"><P><B>Member functions</B></P><P>                Static functions must be public and cannot be virtual.              </P><P>                The syntax of class method declarations is as follows:              </P><P>                </A><BLOCKQUOTECLASS="BLOCKQUOTE"><P>                    <TTCLASS="REPLACEABLE"><I>name</I></TT>                    ([<TTCLASS="REPLACEABLE"><I>arg</I></TT>]..) [const] [=0]                    [/<TTCLASS="REPLACEABLE"><I>optflag</I></TT>[,<TTCLASS="REPLACEABLE"><I>optflag</I></TT>]../]                     ; [<TTCLASS="REPLACEABLE"><I>member_code</I></TT>]                  </P></BLOCKQUOTE>              </P><P> Option flags can be                given in a comma separated list of                <TTCLASS="REPLACEABLE"><I>optflag</I></TT>s enclosed in                slashes. <TTCLASS="REPLACEABLE"><I>optflag</I></TT>s can be                boolean, or take a value. The following flags are                recognized: </P><DIVCLASS="TABLE"></A><P><B>Table C-4. Flags in member function declaration</B></P><TABLEBORDER="1"CLASS="CALSTABLE"><TBODY><TR><TDALIGN="LEFT"VALIGN="TOP">PyName=<TTCLASS="REPLACEABLE"><I>py_name</I></TT></TD><TDALIGN="LEFT"VALIGN="TOP">Use <TTCLASS="REPLACEABLE"><I>py_name</I></TT>                        instead of the C++ function name</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">ReleaseLock</TD><TDALIGN="LEFT"VALIGN="TOP">Release the python interpreter                        lock</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">PreHook=<TTCLASS="REPLACEABLE"><I>hook_function</I></TT></TD><TDALIGN="LEFT"VALIGN="TOP">Define                        <TTCLASS="REPLACEABLE"><I>hook_function</I></TT> to be                        called prior to the memberfunc</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">PostHook=<TTCLASS="REPLACEABLE"><I>hook_function</I></TT></TD><TDALIGN="LEFT"VALIGN="TOP">Define                        <TTCLASS="REPLACEABLE"><I>hook_function</I></TT> to be                        called after the memberfunc</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">Transfer</TD><TDALIGN="LEFT"VALIGN="TOP">Ownership is transferred</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">TransferThis</TD><TDALIGN="LEFT"VALIGN="TOP">Ownership of this is transferred</TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">TransferBack</TD><TDALIGN="LEFT"VALIGN="TOP">Ownership is transferred back</TD></TR></TBODY></TABLE></DIV></BLOCKQUOTE></DD><DT><B>protected</B></DT><DD><P>              If the function is protected, call the public wrapper.              Otherwise, explicitly call the real function and not any              version in the wrapper class (in case it is virtual).              This will prevent virtual loops.  You don't need to              worry about indirected objects for protected functions.            </P></DD><DT><B>signals</B></DT><DD><P></P><ULCOMPACT="COMPACT"><LI><SPAN> Arguments must be simple. Otherwise                  you have to supply your own C++ code.                </SPAN></LI><LI><SPAN> Virtual signals are not supported.                </SPAN></LI></UL></DD><DT><B>slots</B></DT><DD><P></P><ULCOMPACT="COMPACT"><LI><SPAN> Arguments must be simple. Otherwise                  you have to supply your own C++ code.                </SPAN></LI></UL></DD><DT><B>virtual</B></DT><DD><P></P><ULCOMPACT="COMPACT"><LI><SPAN> Static functions cannot be virtual.                </SPAN></LI><LI><SPAN> Virtual signals aren't supported.                </SPAN></LI><LI><SPAN> Arguments must be simple. Otherwise                  you have to supply your own C++ code.                </SPAN></LI></UL></DD><DT><B>const</B></DT><DD><P></P><ULCOMPACT="COMPACT"><LI><SPAN> Accepted for const function                  arguments and const functions.                </SPAN></LI></UL></DD><DT><B>static</B></DT><DD><P></P><ULCOMPACT="COMPACT"><LI><SPAN> <SPANCLASS="ACTION">%VariableCode</SPAN> cannot be specified for non-static class variables. </SPAN></LI><LI><SPAN> Cannot mix static and non-static                  member functions with the same Python name.                </SPAN></LI><LI><SPAN> Static functions must be public and                  cannot be virtual. </SPAN></LI></UL></DD></DL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><A accesskey="P" href="index.lxp@lxpwrap=x9236_252ehtm.htm">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><A accesskey="H" href="index.lxp@lxpwrap=book1_252ehtm">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><A accesskey="N" href="index.lxp@lxpwrap=x9684_252ehtm.htm">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Directives</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><A accesskey="U" href="index.lxp@lxpwrap=a8834_252ehtm.htm">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">SIPLIB Functions</TD></TR></TABLE></DIV></BODY></HTML>      </td>      </tr>      </table>      </td>    </tr>  </table>      

⌨️ 快捷键说明

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