The perfect match between Qt and vs2005/2008 (detailed steps to compile your own Qt4.5.1)

Source: Internet
Author: User
Tags qt designer

Introduced

People who have used Linux must know Qt (not QuickTime, hehe) This name, KDE is written in Qt, I also contact with Linux before I know it.

QT was originally a technology TM (Trolltech) product, Haavard Nord (CEO of Trolltech) and Eirik Chambe-eng (Chairman of Trolltech) began its history in 1991, Three years later, they created the Quasartechnologies company, renamed Trolltech, and its development is closely related to the development of KDE, and it can be said that the release of each KDE release in the early days was a milestone event for Qt. Qt is said to be called because the letter "Q" in the Haavard emacs in the font used in the very PP-_-!, and the letter "T" is toolkit meaning.

Haavard and Eirik to develop QT because they were doing a project (1991) that needed to run in Unix, Macintosh, and Windows environments. That summer day, Haavard and Eirik out for a walk when they sat on a park bench, Haavard said, "We need an object-oriented display system." ”。 The results of this discussion have laid the groundwork for the cross-platform GUI framework they are about to create.

In 1991, working with Eirik in design, Haavard began writing classes that later became QT. In the following time of the year, Eirik proposed the idea of "signals and slots", which is an important feature of QT. At the end of the year, with Haavard's proposal, the two people went down the net to develop "the best C + + GUI framework in the world".

1994 Unfortunately for the two young programmers, there is no client at hand, an unfinished project with no money. Fortunately, their wives have jobs and can support them. )。 After thanking a professor at a university in Haavard, a company gave them the opportunity to develop software running on UNIX and Windows with Qt. Finally on May 20, 1995, Qt 0.90 was released, which is the first public release of Qt.

Then there are many stories, such as the establishment of the QCT KDE organization, changes to the PK,QT protocol for KDE and GNOME, and several important releases of QT, the Nokia Acquisition QT,QT support LGPL agreement, etc., is not introduced. It's a bit off the topic, the introduction is here ...

Why use QT

If you write a cross-platform program, QT is a good choice, of course, there are good other GUI libraries, such as wxwidgets, GTK and so on. I chose QT mainly because the program is simple, can be extended, code ideas clear, document Strong! Generally write the GUI, if the use of the new class are re-check the document, look at the routine, and this is more convenient and flexible than MFC. When using MFC to write programs that are uncomfortable, the code is well-built with wizards, and there are not enough routines for the GUI class in MSDN. Routines are sufficient so that the code can be written on its own, so that the hierarchy is clear.

Installation and compilation

1. Commercial Edition

If you are using a commercial version, then just choose the corresponding development platform can be, such as VS2005SP1, installation can be, together with visual Studio Addon, even the compilation is saved.

2. Open-source Edition

The official version of the MinGW is available, and the QT Creator can be selected. This IDE is more like, support some simple automatic code completion, can easily view doc. It also provides integration support for version control tools like Git, svn, and, of course, Qt Designer and Qt linguist.

If used in vs2005/2008, it's just a DIY compilation. The compilation process is simple, assuming that the IDE is VS2005 and operates as follows:

Simple compilation

A. Download the QT original code package, such as Qt_4.5.1_opensource.zip, to extract a partition that has more than 3.5G of space left.

B. Set the system environment variables:

qtdir--just unzipped the QT root directory,

Add%qtdir%\bin to Path,

qmakespec--win32-msvc2005

C. Open the command Prompt vs, enter:

> Configure

> NMAKE

The compilation takes about 2-4 hours, and the compilation results account for about 3.5G.

Custom compilation

Start with the C step above:

C. Open the command Prompt vs, enter:

> Configure--help

View the available options for configure

I might use it myself:

-release Compiling release version

-debug compiling the Debug version

-debug-and-release two versions are compiled

-shared Compiling DLL versions

-static compiling a static link library version

-fast Configure only generates makefile at the directory level

-no-qt3support does not support QT3

-qt-libjpeg with Qt JPEG decoding, when using System-jpeg, the software released to other computers when the JPG decoding problem

-vcproj Generate VS2005 vcproj Engineering documents, convenient later, generally do not, occupy the place

-phonon video playback support, need DirectShow (DShow)

-direct3d Direct3D Support, D3D SDK required

Attention:

When using the-phonon and-DIRECT3D options, you need to set the environment variables before participating in the QT readme.

DShow installation is cumbersome because MS has stopped dshow support and is replaced by media Foundation, which starts to apply in Vista and Win7. The final version of the DShow environment is the D3D2005 SDK and the direct show package, as if the Windows SDK 2003 and so on, configured, can't remember clearly.

D. Modify QT If you do not want to compile the part

If you do not want to compile the examples directory file, open $ (qtdir) \examples\makefile, modified to (add Skip-all and skip-qmake two lines)

All

Skip-all:

D:\qt\4.5.2-vs2008sp1\bin\qmaked:/qt/4.5.2-vs2008sp1/examples\examples.pro-o Makefile-spec win32-msvc2008

Nmake-f Makefile

First:all

Qmake

Skip-qmake:

D:\qt\4.5.2-vs2008sp1\bin\qmaked:/qt/4.5.2-vs2008sp1/examples\examples.pro-o Makefile-spec win32-msvc2008

This compilation is here when the direct skip, note the settings to be cautious, some directory code may be required to compile the basic library files, especially in the SRC directory. If you do not want to generate qdemo.exe you can similarly modify the $ (qtdir) \demos\makefile file.

E. Post-compilation cleanup

If you are going to move away from modifying the compilation option again, you can clean up some temporary files and eventually reduce to around 800M if you are uncomfortable with QT temp files.

Clean up temporary files under bin except *.pdb and *.dll, note that temporary files refer to files that are compiled and generated, such as *.obj, *.ilk, and so on

Clean the lib under the exception of *.PRL and *.lib temporary files, *.prl do not know what use, anyway small, keep it.

Clean the temporary files under SRC except vc[n].pdb, such as VS2005 is vc80.pdb and vs2008 is vc90.pdb.

Tools, plugin, and qmake directories are similar

Configure VS2005

1. Qt Visual studioadd-in

QT Official Download: http://qt.nokia.com/downloads/visual-studio-add-in

It mainly provides vs2005/2008 integration, such as calling designer, linguist and some help, as well as modifying the debug information display mode, making debug data display more intuitive.

2. It seems that there is no ...

Using QT to write programs

1. Aestheticism-Do not use designer

My personal usual method, how to start QT project?

Create a new directory, such as HI_QT, and then create a new file main.cpp to generate the project file Hi_qt.pro

Qmake-project

Generate vs Project file Hi_qt.vcproj:

QMAKE-TP VC

Open hi_qt.vcproj, Menu Qt->convert project to QT add-in Project so you can create QT class with QT VS add-in functionality.

2. General methods

is the direct use of QT VS add-in guidance, is not sure to generate UI files and QRC files, of course you can delete them afterwards, this is not much to say.

3. Make designer do most of the work

Mainly combining QT VS add-in and designer to do most of the interface work, such as inserting their own defined widgets in the interface, writing style sheet and so on. This is said to be more complex, not much to say, the general use is not much, later have time to organize slowly.

Reference

C + + GUI programming WITHQT 4, 2006, A Brief History of Qt

Qt Assistant 4.5.2

Qt Home

Initial migration and deployment of QT programs under Windows Mobile

Http://www.cnblogs.com/bingcaihuang/archive/2010/12/07/1898661.html

The perfect match between Qt and vs2005/2008 (detailed steps to compile your own Qt4.5.1)

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.