Rapid development of QT applications under Ubuntu14.04

Source: Internet
Author: User

Looking for: Demonstrate how to quickly develop QT applications.


1. Installing the QT Integration environment under Ubuntu

sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig Qt4-demos Qt4-designer

2. Write a simple QT program

First: Create an app folder Qtapp and go to the folder

CD ~

mkdir Qtapp

CD Qtapp

To write a program:

Gedit Test1.cpp

The contents are as follows:

#include <QApplication> #include <qlabel>int main (int argc, char *argv[]) {    qapplication app (argc, argv) ;    Qlabel *label = new Qlabel ("Hello qt!");    Label->show ();    
3. Build a platform-agnostic project file

~/qtapp$ qmake-project

Got a project file named: Qtapp.pro

4. Generate the Makefile file
~/qtapp$ qmake Hello.pro

Get makefile File

5. Generate the target file

~/qtapp$ Make

The display information is:


g++-c-m64-pipe-o2-wall-w-d_reentrant-dqt_no_debug-dqt_gui_lib-dqt_core_lib-dqt_shared-i/usr/share/qt4/mkspecs/ Linux-g++-64-i.-i/usr/include/qt4/qtcore-i/usr/include/qt4/qtgui-i/usr/include/qt4-i.-O test1.o test1.cpp
g++-m64-wl,-o1-o Qtapp Test1.o-l/usr/lib/x86_64-linux-gnu-lqtgui-lqtcore-lpthread

Get the Qtapp executable file

6. Implementation of the target file

./qtapp

Visible program window (look carefully on the screen, because it is relatively small)

Rapid development of QT applications under Ubuntu14.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.