📄 index.lxp@lxpwrap=x9236_252ehtm.htm
字号:
<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™</div> </div> </td></tr></table> <div align="center" class="author"> <a href="../products.lxp">Products</a> | <a href="../wheretobuy.lxp">Where to buy</a> | <a href="../bookstore.lxp">Retailers</a> | <a href="../faq.lxp">FAQ</a> | <a href="../writeforus.lxp">Write for Us.</a> | <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>Directives</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="Sip usage and syntax"HREF="x9022.htm"><LINKREL="NEXT"TITLE="Accepted C++ / Qt constructs"HREF="x9571.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=x9022_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=x9571_252ehtm.htm">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1">Directives</A></H1><P>Sip has a number of directives that control the way C++ code is generated. Since sip is essentially completely undocumented, it was impossible to clearly describe all directives, or even to be sure that this is an exhaustive list. Still, this list come in useful. The directives are grouped according to function: Documentation, Modules, Conditional Elements, C++ and Header Code, Python Code sections, Mapped Classes, Special Python methods and Other.</P><DIVCLASS="SECT2"><H2CLASS="SECT2">Documentation</A></H2><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=r9241_252ehtm">%Copying</A> -- Start of software license <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT><DT><A href="index.lxp@lxpwrap=r9252_252ehtm">%Doc</A> -- Start of a documentation <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT><DT><A href="index.lxp@lxpwrap=r9267_252ehtm">%ExportedDoc</A> -- Start of an exported documentation <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT></DL></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2">Modules</A></H2><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=r9283_252ehtm">%Module</A> -- Definition of the (main) modules name</DT><DT><A href="index.lxp@lxpwrap=r9310_252ehtm">%Include</A> -- Include a file</DT><DT><A href="index.lxp@lxpwrap=r9322_252ehtm">%Import</A> -- Import module (dynamic library)</DT></DL></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2">Conditional Elements</A></H2><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=r9351_252ehtm">%If</A> -- start of a conditional <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT><DT><A href="index.lxp@lxpwrap=r9367_252ehtm">%End</A> -- Terminate <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT><DT><A href="index.lxp@lxpwrap=r9380_252ehtm">Version()</A> -- Condition function for <SPANCLASS="ACTION">%If</SPAN> directive</DT><DT><A href="index.lxp@lxpwrap=r9407_252ehtm">%Version</A> -- Define version value(s) and evaluation methods</DT><DT><A href="index.lxp@lxpwrap=r9425_252ehtm">%PrimaryVersions</A> -- Define list of primary versions</DT><DT><A href="index.lxp@lxpwrap=r9442_252ehtm">%VersionCode</A> -- Start of a version code <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT></DL></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2">C++ and Header Code Sections</A></H2><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=r9459_252ehtm">%HeaderCode</A> -- Start of a C++ header code <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT><DT><A href="index.lxp@lxpwrap=r9471_252ehtm">%ExportedHeaderCode</A> -- Start of an exported C++ header code <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT></DL></DIV></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2">Mapped Classes</A></H2><P>A mapped class <P></P><ULCOMPACT="COMPACT"><LI><SPAN> cannot have super classes, member functions or constructors.</SPAN></LI><LI><SPAN> cannot have a <SPANCLASS="ACTION">%ConvertToSubClassCode</SPAN> directive.</SPAN></LI><LI><SPAN> must have exactly one <SPANCLASS="ACTION">%ConvertFromClassCode</SPAN> directive.</SPAN></LI><LI><SPAN> must have exactly one <SPANCLASS="ACTION">%ConvertToClassCode</SPAN> directive.</SPAN></LI><LI><SPAN> must have exactly one <SPANCLASS="ACTION">%CanConvertToClassCode</SPAN> directive</SPAN></LI></UL> </P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2">Special Python methods</A></H2><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=r9505_252ehtm">PyMethods</A> -- Implement additional Python special methods</DT><DT><A href="index.lxp@lxpwrap=r9516_252ehtm">PyNumberMethods</A> -- Implement numerical Python special methods</DT><DT><A href="index.lxp@lxpwrap=r9527_252ehtm">PySequenceMethods</A> -- Implement Python sequence special methods</DT><DT><A href="index.lxp@lxpwrap=r9538_252ehtm">PyMappingMethods</A> -- Implement Python mapping special methods</DT></DL></DIV><P>Python special methods can be implemented, but code must be supplied. The following directives define additional sections in a class declaration (like public, private etc.). A typical sip file section is as follows:</P><PRECLASS="PROGRAMLISTING"> class X { ... PyMethods: __str__ %MemberCode C++ code (no enclosing braces needed). Number and kind of arguments and return value depend on method (see specialPyMethod in sip.h). %End ... } </PRE></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2">Other</A></H2><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=r9551_252ehtm">%Makefile</A> -- The start of a Makefile code <SPAN><ICLASS="EMPHASIS">_block_</I></SPAN></DT></DL></DIV></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=x9022_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=x9571_252ehtm.htm">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Sip usage and syntax</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">Accepted C++ / Qt constructs</TD></TR></TABLE></DIV></BODY></HTML> </td> </tr> </table> </td> </tr> </table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -