Author: Chen Yuan
I have never admired GCC guys. I also want to play C in the platform today. Of course, I can't use MFC. I look at the current GUI, I feel better than QT. I now have an open source version. Today. Today. Today It is finally successful for a long time.
Download software
Qt4: http://wftp.tu-chemnitz.de/pub/QT/QT/Source/Qt-win-OpenSource-4.1.0-Mingw.exemingw: http://jaist.dl.sourceforge.net/sourceforge/ After mingw / mingw-5.0.0.exe, if the package can be installed, you can use this, there is a mingw http://jaist.dl.sourceforge.net/sourceforge/mingw-install/mingw-install-20050907.tar.gzvs2005: Emule has, slowly moving
1. Install the QT4 very simple .exe program, the next step. Next ..
2. Installing the MINGW is very simple .exe program, if the package is unzipped in the package inside the mingw-install-20050907.tar.gz, it can be copied to the corresponding directory.
3. Compile QT4. (If you are better, you can see this document: c: /qt/4.1.0/doc/html/install-win.html) DOS Enter:
C: CD /QT/4.1.0 Configure
Beginning after building
Make
(Time is too long, take a morning)
Note that if you install the C Builder CB on your computer, you will make a make.exe system to make a mistake under MingW. QT4 I can compile with the NMAKE of VC, or use BC's Make Make. Your own research, here more prompts with MingW's MingW32-Make more prompts You can enter the MingW32-make command to compile, but the environment variable PATH refers to Mingw.
After the compilation is completed, C: /QT/4.1.0> configure.exe
Once in Make
It is too long to have time. After the compilation is completed, it will complete half a job.
4. Configure the VS2005 environment.
Tools-> Options ..-> VC Directories
Plug the MING INCLUDE directory and QT4's include directory to include Files
Plug the mingw's lib directory and QT4 LIB directory to the VC's lib files
5. Test a small program to see if it is successful
a. New project -> Generate file item (English version is makefile processing) Select a directory, name is QT2005 B. Debug Configuring this build command This fill in make debug clean command This fill in make Clean Output this DEBUG / QT2005 .exe
c. release configure this build command This fills in the Make Release Clean command This fills the make Clean Output This fills the release / qt2005.exe completed. d. Project (item) -> Properties -> nmake (at the bottom) -> Rebuild All command line This fills in this (DEBUG section)
Qmake -Project Qmake make Clean make Debug
Release partial configuration
Qmake -Project qmake make clean make release5.project (item) -> add new item ... Add a project to create a main.cpp
#include
INT Main (int Argc, char * argv []) {QApplication App (Argc, Argv); QPushbutton Hello ("Hello World!"); Hello.resize (100, 30); Qobject :: Connect (& Hello, Signal (Clicked ()), & App, slot (quit ())); hello.show (); return app.exec ();
OK compile, pay attention to compilation is MINGW32-Make compiled, you can see G a pile of things out. Just success. Generate: 1 has been successful. Run a look.
6. Use the QT4 designer in VC2005 a. Prepretermn the tool to create a main window, casually drag the control. Save the file to qt2005.ui b. Increase the UIC Qt2005.ui -o qtvs2005.h; You can also generate qtvs2005.h files c. Add QT2005.ui files and qtvs2005.h files to the VC project. Set the QT2005.ui open mode to the QT4 designer default open.
D. Code
#include "qtvs2005.h"
INT main (int Argc, char * argv []) {qapplication app (argc, argv); QMainWindow * mainw = new qMainWindow; ui :: mainwindow * ui = new ui :: mainwindow (); ui-> setupui (mainw) Mainw-> show (); return app.exec (); return app.exec ();
Compile, run, you have just dragged out the window. I have no problem in testing Chinese. Good thing!