⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfunc.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/doc/mainwidget.doc:1 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><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><td width="200" align="left" valign="top"><a href="index.html"><img height="27" width="472" src="dochead.png" border="0"></a><br><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qtopia</font>   <a href="index.html">Home</a> - <a href="qtopiaclasses.html">Classes</a> - <a href="qtopiaannotated.html">Annotated</a> - <a href="qtopiafunctions.html">Functions</a> - <a href="qtindex.html">Qt Embedded</a></td><td align="right" valign="top">  <table border="0" cellpadding="0" cellspacing="0" width="137">  <tr>  <td><a href="http://www.trolltech.com/company/about/trolls.html"><img height="100" width="100" src="face.png" border="0"></a></td>  <td><img height="100" width="100" src="qtlogo.png" align="top" border="0"></td>  </tr>  </table></td></tr></table><p> <p> <h2> Qtopia - The main() function</h2><a name="1"></a><p> Starting with Qtopia 1.7, it is no longer recommended that the main()function be written explicitly by the programmer.  Instead two macrosare provided to declare the application entry point:<p> <pre>QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION)QTOPIA_MAIN</pre> <p> QTOPIA_ADD_APPLICATION() generates code to instantiate the main window,where NAME is the application executable name and IMPLEMENTATION is theapplication window class.<p> QTOPIA_MAIN is either the main() implementation or the interface codenecessary to make the application a <em>quicklauncher</em> plugin (ifQTOPIA_APP_INTERFACE is defined - see below).<p> The main.cpp of all applications should be modeled onthis example:<p> <pre>#include "mymainwindow.h"#include &lt;qtopia/qpeapplication.h&gt;QTOPIA_ADD_APPLICATION("myapp", MyMainWindow)QTOPIA_MAIN</pre> <p> The application window should be implemented in a self-contained way:it should not perform application-level operations such as testingparameters, calling exit(), or calling quit(); all of these arehandled by <a href="qpeapplication.html">QPEApplication</a>. Your application window should call close()if it needs to explicitly close, and it must be prepared for thepossibility that show() will be called again after the close() butbefore the application window destructor. In other words, implementyour application window in a way that it could be used easily fromother applications. If you take this approach it will also mean thatmost of your program can be trivially reused on Qt/X11, Qt/Windows,Qt/Mac, and any other ports of the Qt API.<p> <h3> Enabling Quicklaunching</h3><a name="1-1"></a><p> Starting with Qtopia 1.7, applications can be built as plugins thatcan be loaded by the <em>quicklaucher</em>.The quicklauncher is a stub application that ispre-loaded and can load an application plugin and change personality tothe plugin application.  The benefit of loading Qtopia applications in thisway is that much of the functionality that the application needs is pre-loadedand pre-initialised, so the application loading time is significantlyreduced.  Quicklauncher-enabled applications can be run on older Qtopiaplatforms by first installing the quicklauncher package.<p> In order to build an application as a quicklauncher application plugin,main.cpp must be implemented as above.  Then modify thetmake project file to build the application as a library and compilewith the plugin interface code enabled by defining QTOPIA_APP_INTERFACE),for example:<p> <pre>TEMPLATE = libCONFIG  += qtopiaDEFINES += QTOPIA_APP_INTERFACEHEADERS  = mymainwindow.hSOURCES  = mymainwindow.cpp main.cppTARGET   = myapp</pre> <p> Application plugins must be installed in QPEDIR/plugins/application/.<p> When building an application as a quicklauncher application plugin it isimportant to be careful of symbol collisions.  Because the application is compiled as a plugin to be loaded, it is possible for symbols used inthe application to collide with those of the libraries.<p> For example, if there are two classes of the same name, one in theapplication and one in the library the application links to, then it ispossible that when the application is run as a quicklauncher applicationthe wrong destructor for the class will be called.  This can in turn leadto memory corruption.<p> The script <tt>$QPEDIR/scripts/checksymbols</tt> has been provided in orderto help with the identification of possible symbol conflicts.  Make sure QPEDIR is definedand run the script, passing the .so file created for your application as theargument.  The script will list possible symbol collision between yourapplication and the Qtopia libraries.<p> <!-- eof --><p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright &copy; 2001-2004 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align="right"><div align="right">Qtopia version 2.0.0</div></table></div></address></body></html>

⌨️ 快捷键说明

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