Qt

来自开放百科 - 灰狐
2010年2月1日 (一) 08:05Allen (讨论 | 贡献)的版本

跳转到: 导航, 搜索

Qt is a cross-platform application and UI framework. Using Qt, you can write applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.

Qt Product Arch

Develop applications and user interfaces once, and deploy them across Windows, Mac, Linux/X11, embedded Linux, Windows CE and S60 (coming soon) without rewriting the source code.

目录

Qt Roadmap

http://qt.nokia.com/developer/qt-roadmap

Webkit

QtWebKit

Eclipse

Qt Eclipse Integration

Qt Eclipse Integration for C++

VS

Qt Visual Studio Integration

Qt is integrated with the Microsoft Visual Studio .NET and Eclipse integrated development environments. This means Qt programmers can use the IDE they are most comfortable with to do cross-platform development.

安装QT SDK 后,默认采用的是动态链接库的编译方式, 要生成静态的版本, 就需要自己重新进行编译.

设置 QMAKESPEC 为 win32-msvc2008 或 win32-msvc2005 的环境变量
设置 QTDIR 环境变量 如: C:\Qt\2009.05\qt
加入 C:\Qt\2009.05\qt\bin 到 PATH中
打开一个 Visual Studio command prompt 命令窗口
echo %QMAKESPEC%
configure.exe --help
C:\Qt\2009.05\qt\mkspecs\win32-msvc2008\qmake.conf
QMAKE_LFLAGS            = -static
configure -release -shared -static -fast -stl -help -qt-zlib -qt-sql-odbc -qt-sql-sqlite -openssl -vcproj -phonon -multimedia -script -webkit
nmake

常见错误

cannot open input file 'QtCored4.lib'// 是因为没有进行静态编译. 需先进行前面的操作. Qt 2009.05


编译出的是类似 QtWebKitd4.lib, 而不是 QtWebKit4.lib // Qt 2009.05

编译出 QtWebKitd4.lib Failed to write the updated manifest to the resource of file QtWebKitd4.dll // Qt 2010.01

QtUiToolsd.lib没编译出来 ?

需要什么库就编译什么库, 如编译 SQLite3

cd %QTDIR%\src\plugins\sqldrivers\sqlite
qmake "INCLUDEPATH+=C:\sqlite-3.6.22" "LIBS+=C:\Qt\2010.01\qt\plugins\sqldrivers\qsqlite.lib" sqlite.pro
nmake

在C:\Qt\2010.01\qt\plugins\sqldrivers下创建了qsqlite4.dll, qsqlite4.lib, qsqlited4.dll, qsqlited4.lib

PostgreSQL

cd $QTDIR/src/plugins/sqldrivers/psql
qmake "INCLUDEPATH+=C:\pgsql-8.3.6\include" "LIBS+=C:\pgsql-8.3.6\lib\libpq.lib" psql.pro
nmake

在C:\Qt\2010.01\qt\plugins\sqldrivers下创建了 qsqlpsql4.lib, qsqlpsql4.dll, qsqlpsqld4.dll, qsqlpsqld4.lib

Code

Qt hello world

#include <QtGui>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QLabel label("Hello, world!");
    label.show();
    return app.exec();
}

Compiling and executing

1. Create a folder named Hello
2. Copy paste the above program as Hello.cpp in folder Hello
3. At Hello folder run

 a. qmake -project
 b. qmake 
 c. make/gmake/nmake - as needed by OS and your compiler setups

4. Execute ./release/Hello (Or release\Hello.exe in Windows)

Plugins

Qt provides two APIs for creating plugins:

  • A higher-level API for writing extensions to Qt itself: custom database drivers, image formats, text codecs, custom styles, etc.
  • A lower-level API for extending Qt applications.

http://docs.huihoo.com/qt/4.6/plugins.html

Qt Extended

http://qtextended.org

CORBA

Qt CORBA Framework

SOAP

The Qt SOAP project provides basic web service support with version 1.1 of the SOAP protocol.

SSL

SSL Socket

MFC

Qt/MFC Migration Framework

Projects

Links

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱