码迷,mamicode.com
首页 > 系统相关 > 详细

linux QT 配置

时间:2016-08-17 14:11:42      阅读:390      评论:0      收藏:0      [点我收藏+]

标签:qt

Do you want to do programming in Linux? Probably you need C++ programming environment in Linux. Then you need a GUI programming toolkit for C++.You can choose C++ with Qt Framework programming environment in Ubuntu. I will show you how to get them all (complete with C++ library and an IDE) Ubuntu 15.04. Magically, you get them all just by installing Qt Creator.

技术分享
Qt Creator, C++, and Qt Framework

About build-essential

The build-essential is a metapackage (package that pull another packages) to install all C++ programming tools in Ubuntu. If you install it, you will get GNU g++ (a most used C++ compiler), GNU gcc (a most used C compiler), make (a build utility), libc-dev (a collection of GNU C Library), and dpkg-dev (a collection of dpkg tool for developing Debian package). In Ubuntu 15.04, you already got them all pre-installed. You do not need to install it again.

In Ubuntu 12.04, you still need to install build-essential by command

sudo apt-get install build-essential

Install Qt Creator

By GUI, you can use Ubuntu Software Center to search qt creator and install it.

技术分享
Installing Qt Creator by GUI

By Terminal, you can use this command:

sudo apt-get install qtcreator
技术分享
Installing Qt Creator by Terminal

It will download approximately 38 MB packages. It needs approximately 144 MB disk space when finished.

Install Qt Framework Complete Documentation

By default, you get no documentation by just installing qtcreator package. If you need Qt examples, demos, complete documentation, so you can read it inside Qt Creator offline, install them by this command.

sudo apt-get install qt5-doc qtbase5-examples qtbase5-doc-html
  • qt5-doc : this package contains  Qt 5 API Documentation.

  • qtbase5-examples : this package contains Qt base 5 examples.

  • qtbase5-doc-html : this package contains the HTML documentation for the Qt 5 base libraries

技术分享
Qt C++ Program Examples

Using Qt Creator

For first usage, you can create a C++ GUI program by using Qt Widget Project option in Qt Creator. Actually, you have so many other project templates, but for the first time you should try this first. Create it by menu New File or Project (Ctrl+N) > select Project > select Qt Widget Application > press Choose button > type your project name > next, next, and finish. To compile your C++/Qt project, press Run button (green triangle icon on the left panel) or just Ctrl+R. See picture below.

技术分享

Selecting Project

技术分享
Running Program

Using Qt Documentation

1. C++/Qt Examples - After installing those three packages, open Examples section in Qt Creator. You will see many C++/Qt program examples. Click one and you have it. Just run (Ctrl+R) you build and execute it. See picture below.

技术分享
Running C++/Qt Example

2. Qt API Reference - You get also Qt API Documentation completely. And you do not need internet to read it. For examples, if you use a Qt Class in your source code, say it QPushButton, just put your cursor on that text, and press F1. Qt Creator will show you the QPushButton Class API Reference in right panel. See picture below. See the right panel.

技术分享
Left Panel Qt API Reference Documentation

You get also complete Qt API References for whole Qt Framework. To see them, open Qt Creator > click Help icon on the left panel > select Qt 5.x.x Reference from left entry > see documentation on the right panel. You also have all the rest of another Qt related documentation (such as Qt Dbus, Qt Designer, Qt Quick, and many more manuals) on the same left panel. See picture below.

技术分享
Complete Qt Framework Documentation

3. Qt Creator IDE Documentation - You get also Qt Creator IDE documentation. It is a comprehensive help in Qt Creator usage as an advanced editor. You get all you need here. To see it, just open Qt Creator and click Help icon on the left panel and click Home icon on top panel. But you should configure it first to show the Main Page by menu Tools > Options > Help > tab Documentation > Add > the file path is /usr/share/qtcreator/doc/qtcreator.qch . See picture below.

技术分享
Qt Creator IDE Documentation

Reference


linux QT 配置

标签:qt

原文地址:http://11496263.blog.51cto.com/11486263/1839455

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!