个人工具

“Qt”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(InsideQt.com)
第1行: 第1行:
{{Infobox_Software |
+
编辑中
  name = Qt|
+
  logo = [[Image:Qt original r thumb.gif]] |
+
  screenshot = [[Image:Qt-designer-v4.2.1.png|300px|The Qt designer used for GUI designing]] |
+
  caption = 用 Qt Designer 做 [[GUI]] 設計 |
+
  developer = [[Nokia]] |
+
  latest_release_version = 4.5.1 |
+
  latest_release_date = [[2009年]][[4月]] |
+
  operating_system = [[跨平台 ]] |
+
  genre = 開發程式庫 |
+
  license = [[GNU General Public License|GPL]], [[Proprietary software|Proprietary]], [[Q Public License|QPL]] |
+
  website = [http://www.trolltech.com/products/qt Qt 官方網站] |
+
}} '''Qt工具包'''是一个跨平台的[[图形界面]]开发工具。Qt 被主要用在了 [[KDE]] 桌面环境的开发中。是[[挪威]] [[Trolltech]] 公司的产品(2008年被Nokia公司收购)。 使用 Qt 开发的软件,可以在不同的平台下进行编译,便可以达到这个平台的本地图形界面的风格。比如在 Qt 库里的按钮 QButton,在 [[Microsoft Windows]] 下编译就会和其他的Windows程序的按钮外观相同。而在[[蘋果公司]] 的 [[Mac OS]]上编译后,这个按钮的外观就和其他苹果 Mac OS 平台上的程序的按钮外观相同。
+
  
使 Qt 和其他工具包不同的是,尽管它是一个公司的商业产品,但是它也提供[[自由软件]]的用户协议,并且[[开放源代码]]。使得它可以被广泛地应用在各平台上的开放源代码[[软件]]开发中。
+
[[Image:Qt4-logo.png]]  
  
使用 Qt 开发的软件除了著名的的桌面环境 KDE 外,还有 [[Google Earth]],VirtualBox,VLCPlayer。
+
Qt是跨平台的C++图形开发框架,发家史/辛酸史详细去看[http://zh.wikipedia.org/wiki/Qt wikipedia],KDE环境就是用Qt开发的,最新的版本是Qt4.5.2。
  
== 外部連結 ==
+
=编译环境=
 +
== Hello World ==
 +
<source lang="cpp">
 +
#include <QtGui/QApplication>
 +
#include <QtGui/QLabel>
 +
 +
int main(int argc, char *argv[])
 +
{
 +
    QApplication app(argc, argv);
 +
    QLabel label("Hello, world!");
 +
    label.show();
 +
    return app.exec();
 +
}
  
*[http://groups.google.com/group/qt-china Qt中文邮件列表](Qt中文邮件列表){{zh-cn}}
+
</source>
*[http://www.qtopia.org.cn/phpBB2/ Qt/Qtopia中文论坛](Qt/Qtopia中文论坛){{zh-cn}}
+
编译:
*[http://www.qtcn.org/ Qt中文网论坛](Qt中文网论坛){{zh-cn}}
+
qmake -project
*[http://www.emb-kb.com/doku.php/詞解/greenphone Qtopia Greenphone] - 以Qt為基礎的開發驗證用行動電話手機,屬於軟體開發套件的一環。{{zh-tw}}
+
qmake
*[http://www.qteverywhere.com/ Qt Everywhere](Qt中文博客){{zh-cn}}[[Ca:Qt]]
+
make
*[http://www.InsideQt.com/bbs/ InsideQt.com](Qt核心技术论坛){{zh-cn}}
+
  
<br>[[Cs:Qt (knihovna)]] [[De:Qt (Bibliothek)]] [[En:Qt (toolkit)]] [[Es:Qt (biblioteca)]] [[Fi:Qt]] [[Fr:Qt]] [[Hu:Qt]] [[Id:Qt toolkit]] [[It:Qt (toolkit)]] [[Ja:Qt]] [[Ko:Qt (툴킷)]] [[Nl:Qt-toolkit]] [[No:Qt]] [[Pl:Qt]] [[Pt:Qt]] [[Ru:Qt]] [[Sv:Qt]]
+
= Qtcreator  =
  
[[Category:编程环境]] [[Category:KDE]]
+
Qt4.5后 附带的轻量级IDE开发环境。
 +
 
 +
[[Image:Qtcreator.png]]
 +
 
 +
== 安装  ==
 +
 
 +
*从 '''[[UbuntuHelp:SynapticHowto/zh|新利得软件包管理器]][[UbuntuHelp:Synaptic|Synaptic]]'''或者[[Kpackagekit|KPackageKit(Kubuntu默认的软件管理)]] 中搜索qt-creator,选择安装<br />
 +
*Firefox浏览器地址栏中输入apt:qt-creator
 +
*从 apt-get 命令安装:<br />
 +
<pre>sudo apt-get install qt-creator
 +
</pre>
 +
<br />
 +
 
 +
== 中文界面  ==
 +
 
 +
如果安装的qtcreator是显示英文菜单,需要安装KDE的中文包才能显示中文菜单。
 +
<pre>sudo apt-get install language-pack-kde-zh language-pack-kde-zh-base
 +
</pre>
 +
=== 待编辑  ===
 +
 
 +
== 编译环境  ==
 +
安装KDE 开发环境:
 +
sudo aptitude install kde-devel build-essential xorg-dev cdbs debhelper cmake \
 +
kdesdk-scripts subversion ssh xserver-xephyr doxygen dbus-x11 \
 +
libxml2-dev libxslt1-dev shared-mime-info libical-dev libgif-dev libssl-dev \
 +
libboost-dev libboost-program-options-dev libgpgme11-dev libxine-dev \
 +
libqimageblitz-dev libbz2-dev libdbus-1-dev libpam0g-dev libpcre3-dev \
 +
libkrb5-dev libsm-dev libclucene0ldbl libclucene-dev libjpeg62-dev \
 +
libxtst-dev xsltproc libxrender-dev libfontconfig1-dev automoc4
 +
==Fakevim的使用==
 +
在编辑器中按住ALT键同时按两下字母键V,就可以进入仿vim模式,在此模式下可以用vim的快捷键来编辑文件。退出vim模式可以连按两下字母键“,”。
 +
The FakeVim feature can be triggered using Alt+V, V, enabling Qt Creator to emulate vim. In this mode, typical vim
 +
commands can be used to edit text. To exit this mode, simply type “,,”.
 +
 
 +
== Hello World ==
 +
<!-- KDE 4 Hello world -->
 +
 
 +
<source lang="cpp">
 +
#include <KApplication>                                                           
 +
#include <KAboutData>                                                             
 +
#include <KCmdLineArgs>                                                           
 +
#include <KMessageBox>                                                             
 +
                                                                                   
 +
int main (int argc, char *argv[])                                                 
 +
{                                                                                 
 +
    KAboutData aboutData(                                                         
 +
                        // The program name used internally.                     
 +
                        "tutorial1",                                             
 +
                        // The message catalog name
 +
                        // If null, program name is used instead.
 +
                        0,
 +
                        // A displayable program name string.
 +
                        ki18n("Tutorial 1"),
 +
                        // The program version string.
 +
                        "1.0",
 +
                        // Short description of what the app does.
 +
                        ki18n("Displays a KMessageBox popup"),
 +
                        // The license this code is released under
 +
                        KAboutData::License_GPL,
 +
                        // Copyright Statement
 +
                        ki18n("(c) 2007"),
 +
                        // Optional text shown in the About box.
 +
                        // Can contain any information desired.
 +
                        ki18n("Some text..."),
 +
                        // The program homepage string.
 +
                        "http://tutorial.com/",
 +
                        // The bug report email address
 +
                        "[email protected]");
 +
 
 +
    KCmdLineArgs::init( argc, argv, &aboutData );
 +
    KApplication app;
 +
    KGuiItem yesButton( i18n( "Hello" ), QString(),
 +
                        i18n( "This is a tooltip" ),
 +
                        i18n( "This is a WhatsThis help text." ) );
 +
    KMessageBox::questionYesNo( 0, i18n( "Hello World" ),
 +
                                i18n( "Hello" ), yesButton );
 +
    return 0;
 +
}
 +
</source>
 +
保存为main.cpp
 +
 
 +
现在需要一个CMakeLists.txt:
 +
<pre>project (tutorial1)
 +
find_package(KDE4 REQUIRED)
 +
include (KDE4Defaults)
 +
include_directories(${KDE4_INCLUDES})
 +
set(tutorial1_SRCS main.cpp)
 +
kde4_add_executable(tutorial1 ${tutorial1_SRCS})
 +
target_link_libraries(tutorial1 ${KDE4_KDEUI_LIBS})
 +
install(TARGETS tutorial1  ${INSTALL_TARGETS_DEFAULT_ARGS})</pre>
 +
编译:
 +
<source lang="bash">
 +
mkdir build && cd build
 +
cmake ..
 +
make
 +
./tutorial1
 +
</source>
 +
 
 +
=KDevelop=
 +
KDE开发的IDE,最新的稳定版是qt3.5做的,移植qt4的还在开发中。
 +
 
 +
==安装==
 +
*从 '''[[UbuntuHelp:SynapticHowto/zh|新利得软件包管理器]][[UbuntuHelp:Synaptic|Synaptic]]'''或者[[Kpackagekit|KPackageKit(Kubuntu默认的软件管理)]] 中搜索kdevelop,选择安装<br>
 +
*Firefox浏览器地址栏中输入apt:kdevelop
 +
*从 apt-get 命令安装:<br>
 +
<pre>sudo apt-get install kdevelop
 +
</pre>
 +
<br />
 +
 
 +
=== KDE 4版本 ===
 +
*从[[UbuntuHelp:Synaptic|Synapitc]]或[[Kpackagekit|KPackageKit]]里搜索'''kdevelop-kde4'''(如果是Karmic Koala,就是kdevelop),安装<br />
 +
*Firefox浏览器地址栏中输入apt:kdevelop-kde4(如果是Karmic Koala,就是kdevelop)
 +
*命令安装:<br />
 +
sudo aptitude install kdevelop-kde4 #(如果是Karmic Koala,就是kdevelop)
 +
 
 +
== 中文界面  ==
 +
 
 +
如果安装的qtcreator是显示英文菜单,需要安装KDE的中文包才能显示中文菜单。
 +
<pre>sudo apt-get install language-pack-kde-zh language-pack-kde-zh-base
 +
</pre>
 +
 
 +
=Monkeystudio=
 +
轻量级的IDE,[http://www.monkeystudio.org/ monkeystudio官网]
 +
 
 +
=Netbean=
 +
=Eclipse=
 +
 
 +
 
 +
 
 +
= 外部链接  =
 +
 
 +
[http://zh.wikipedia.org/wiki/Qt 维基百科对Qt的介绍]
 +
 
 +
=== 官方  ===
 +
 
 +
[http://www.qtsoftware.com/ Qt官方主页]
 +
 
 +
[http://qt.gitorious.org/ Qt 源代码]
 +
 
 +
[http://labs.trolltech.com/page/Overview Qt 实验室]
 +
 
 +
[http://doc.trolltech.com/ Qt 在线文档]
 +
 
 +
[http://www.qt-apps.org/ 免费Qt 应用程序]
 +
 
 +
=== 教学与参考文件  ===
 +
 
 +
[http://caterpillar.onlyfun.net/Gossip/Qt4Gossip/Qt4Gossip.html Qt4 學習筆記]
 +
 
 +
[http://program-lover.blogspot.com/2008/08/qt.html Qt 教學]
 +
 
 +
[http://thelins.se/learnqt/ learnqt英文blog]
 +
 
 +
=== 论坛  ===
 +
 
 +
[http://qtcentre.org/ Qt 社群網站]
 +
 
 +
[http://groups.google.com/group/qt-china google论坛]
 +
 
 +
[http://groups.google.com/group/qt-china Qt中文邮件列表]
 +
 
 +
[http://www.qtopia.org.cn/phpBB2/ Qt/Qtopia中文论坛]
 +
 
 +
[http://www.qtcn.org/ Qt中文论坛]
 +
[http://www.qtkbase.com/ 另一个Qt中文论坛]
 +
[http://www.qteverywhere.com/ Qt Everywhere]
 +
 
 +
=== Planet  ===
 +
 
 +
[http://www.planetqt.org/ planetqt] [http://planetkde.org/ planetkde]
 +
 
 +
=== 书籍  ===
 +
 
 +
[http://www.douban.com/subject/3173123/ 《C++ GUI Qt4 编程(第二版)》]
 +
 
 +
=== 参考 ===
 +
[http://techbase.kde.org/Getting_Started/Build/KDE4/Kubuntu_and_Debian KDE TechBase Kubuntu 编译环境]
 +
{{KDE}}

2010年3月29日 (一) 21:38的版本

编辑中

Qt4-logo.png

Qt是跨平台的C++图形开发框架,发家史/辛酸史详细去看wikipedia,KDE环境就是用Qt开发的,最新的版本是Qt4.5.2。

编译环境

Hello World

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

编译:

qmake -project 
qmake 
make

Qtcreator

Qt4.5后 附带的轻量级IDE开发环境。

Qtcreator.png

安装

sudo apt-get install qt-creator


中文界面

如果安装的qtcreator是显示英文菜单,需要安装KDE的中文包才能显示中文菜单。

sudo apt-get install language-pack-kde-zh language-pack-kde-zh-base

待编辑

编译环境

安装KDE 开发环境:

sudo aptitude install kde-devel build-essential xorg-dev cdbs debhelper cmake \
kdesdk-scripts subversion ssh xserver-xephyr doxygen dbus-x11 \
libxml2-dev libxslt1-dev shared-mime-info libical-dev libgif-dev libssl-dev \
libboost-dev libboost-program-options-dev libgpgme11-dev libxine-dev \
libqimageblitz-dev libbz2-dev libdbus-1-dev libpam0g-dev libpcre3-dev \ 
libkrb5-dev libsm-dev libclucene0ldbl libclucene-dev libjpeg62-dev \
libxtst-dev xsltproc libxrender-dev libfontconfig1-dev automoc4

Fakevim的使用

在编辑器中按住ALT键同时按两下字母键V,就可以进入仿vim模式,在此模式下可以用vim的快捷键来编辑文件。退出vim模式可以连按两下字母键“,”。 The FakeVim feature can be triggered using Alt+V, V, enabling Qt Creator to emulate vim. In this mode, typical vim commands can be used to edit text. To exit this mode, simply type “,,”.

Hello World

#include <KApplication>                                                             
#include <KAboutData>                                                               
#include <KCmdLineArgs>                                                             
#include <KMessageBox>                                                              
                                                                                    
int main (int argc, char *argv[])                                                   
{                                                                                   
    KAboutData aboutData(                                                           
                         // The program name used internally.                       
                         "tutorial1",                                               
                         // The message catalog name
                         // If null, program name is used instead.
                         0,
                         // A displayable program name string.
                         ki18n("Tutorial 1"),
                         // The program version string.
                         "1.0",
                         // Short description of what the app does.
                         ki18n("Displays a KMessageBox popup"),
                         // The license this code is released under
                         KAboutData::License_GPL,
                         // Copyright Statement
                         ki18n("(c) 2007"),
                         // Optional text shown in the About box.
                         // Can contain any information desired.
                         ki18n("Some text..."),
                         // The program homepage string.
                         "http://tutorial.com/",
                         // The bug report email address
                         "[email protected]");

    KCmdLineArgs::init( argc, argv, &aboutData );
    KApplication app;
    KGuiItem yesButton( i18n( "Hello" ), QString(),
                        i18n( "This is a tooltip" ),
                        i18n( "This is a WhatsThis help text." ) );
    KMessageBox::questionYesNo( 0, i18n( "Hello World" ),
                                i18n( "Hello" ), yesButton );
    return 0;
}

保存为main.cpp

现在需要一个CMakeLists.txt:

project (tutorial1)
find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include_directories(${KDE4_INCLUDES})
set(tutorial1_SRCS main.cpp)
kde4_add_executable(tutorial1 ${tutorial1_SRCS})
target_link_libraries(tutorial1 ${KDE4_KDEUI_LIBS})
install(TARGETS tutorial1  ${INSTALL_TARGETS_DEFAULT_ARGS})

编译:

mkdir build && cd build
cmake ..
make
./tutorial1

KDevelop

KDE开发的IDE,最新的稳定版是qt3.5做的,移植qt4的还在开发中。

安装

sudo apt-get install kdevelop


KDE 4版本

  • SynapitcKPackageKit里搜索kdevelop-kde4(如果是Karmic Koala,就是kdevelop),安装
  • Firefox浏览器地址栏中输入apt:kdevelop-kde4(如果是Karmic Koala,就是kdevelop)
  • 命令安装:
sudo aptitude install kdevelop-kde4 #(如果是Karmic Koala,就是kdevelop)

中文界面

如果安装的qtcreator是显示英文菜单,需要安装KDE的中文包才能显示中文菜单。

sudo apt-get install language-pack-kde-zh language-pack-kde-zh-base

Monkeystudio

轻量级的IDE,monkeystudio官网

Netbean

Eclipse

外部链接

维基百科对Qt的介绍

官方

Qt官方主页

Qt 源代码

Qt 实验室

Qt 在线文档

免费Qt 应用程序

教学与参考文件

Qt4 學習筆記

Qt 教學

learnqt英文blog

论坛

Qt 社群網站

google论坛

Qt中文邮件列表

Qt/Qtopia中文论坛

Qt中文论坛 另一个Qt中文论坛 Qt Everywhere

Planet

planetqt planetkde

书籍

《C++ GUI Qt4 编程(第二版)》

参考

KDE TechBase Kubuntu 编译环境

KDE

核心技术: Plasma | Plasmoid | Qt

应用程序:Akregator | Amarok| Dolphin | Kontact | Kmail|Kate | Konversation | Quassel

其他:安装Kubuntu| Kubuntu速配指南 | Kubuntu加速 | Kubuntu美化 | Kubuntu输入法皮肤| Kubuntu安装/删除软件,更新系统 | Smooth_tasks | KDE3