QT学习笔记(四):在不同平台上部署QT程序概述

JUST FOR QT 4.6

Deploying Qt Applications

Deploying an Qt application does not require any C++ programming. All you need to do is to build Qt and your application in release mode, following the procedures described in this documentation. We will demonstrate the procedures in terms of deploying the Plug & Paintapplication that is provided in Qt's examples directory.

Static vs. Shared Libraries

There are two ways of deploying an application:

  • Static Linking
  • Shared Libraries (Frameworks on Mac)

Static linking results in a stand-alone executable. The advantage is that you will only have a few files to deploy. The disadvantages are that the executables are large and with no flexibility (i.e a new version of the application, or of Qt, will require that the deployment process is repeated), and that you cannot deploy plugins.

To deploy plugin-based applications, you can use the shared library approach. Shared libraries also provide smaller, more flexible executables. For example, using the shared library approach, the user is able to independently upgrade the Qt library used by the application.

Another reason why you might want to use the shared library approach, is if you want to use the same Qt libraries for a family of applications. In fact, if you download the binary installation of Qt, you get Qt as a shared library.

The disadvantage with the shared library approach is that you will get more files to deploy. For more information, see Creating Shared Libraries.

Deploying Qt's Libraries

Qt's Libraries
QtAssistantQAxContainerQAxServerQtCore
QtDBusQtDesignerQtGuiQtHelp
QtNetworkQtOpenGLQtScriptQtScriptTools
QtSqlQtSvgQtWebKitQtXml
QtXmlPatternsPhononQt3Support 

Since Qt is not a system library, it has to be redistributed along with your application; the minimum is to redistribute the run-time of the libraries used by the application. Using static linking, however, the Qt run-time is compiled into the executable.

In general, you should deploy all plugins that your build of Qt uses, excluding only those that you have identified as being unnecessary for your application and its users.

For instance, you may need to deploy plugins for JPEG support and SQL drivers, but you should also deploy plugins that your users may require, including those for accessibility. For more information about plugins, see the How to Create Qt Plugins documentation.

When deploying an application using the shared library approach you must ensure that the Qt libraries will use the correct path to find the Qt plugins, documentation, translation etc. To do this you can use a qt.conf file. For more information, see the Using qt.conf documentation.

Depending on configuration, compiler specific libraries must be redistributed as well. For more information, see the platform specific Application Dependencies sections: X11WindowsMac.

Licensing

Some of Qt's libraries are based on third party libraries that are not licensed using the same dual-license model as Qt. As a result, care must be taken when deploying applications that use these libraries, particularly when the application is statically linked to them.

The following table contains an inexhaustive summary of the issues you should be aware of.

Qt LibraryDependencyLicensing Issue
QtHelpCLuceneThe version of clucene distributed with Qt is licensed under the GNU LGPL version 2.1 or later. This has implications for developers of closed source applications. Please see the QtHelp module documentation for more information.
QtNetworkOpenSSLSome configurations of QtNetwork use OpenSSL at run-time. Deployment of OpenSSL libraries is subject to both licensing and export restrictions. More information can be found in the Secure Sockets Layer (SSL) Classesdocumentation.
QtWebKitWebKitWebKit is licensed under the GNU LGPL version 2 or later. This has implications for developers of closed source applications. Please see the QtWebKit module documentation for more information.
PhononPhononPhonon relies on the native multimedia engines on different platforms. Phonon itself is licensed under the GNU LGPL version 2. Please see the Phonon module documentation for more information on licensing and the Phonon Overview for details of the backends in use on different platforms.

Platform-Specific Notes

The procedure of deploying Qt applications is different for the various platforms:

See also Installation and Platform-Specific Documentation.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值