I cost about a week to set up Qt4 integrated with Visual 2005, and I find that English Documents about this topic are out of time. There is a piece of German Document ("QT 4.x unter Windows und Visual Studio 2005") is very good. so I tanslate part of it into English. So, I am glad to share it with you.
QT 4.3.2 with Visual Studio 2005
1. Create a new Project
“File -> New -> Project ...”, then choose “Other Project Types -> Visual Studio Solutions -> Blank Solution” and set the solution name and location.
After creating the solution, open the Solution Explorer , choose and click right mouse button the Solution, click Add -> New Project ... in the pop-menu. In the opening dialog choose “Visual C++ -> Win32 -> Win32 Console Application”, and then set the project name. In the opening dialog, click “Next” or “Application Settings”, and choose “Console application” and “Empty project”, the click “Finish” after that you create an empty project.
2. Add a “cpp” file to the project
Click the right mouse button on the sub-folder Source Files and click “Add -> New Item”. In the following dialog, choose “Visual C++ -> Code -> C++ File (.cpp)” and set the file name. In this example, we set it “main.cpp”. In the “Solution Explorer -> Source Files”, you can will find a new file named “main.cpp”
3. Use the QT Designer
Open the “QT Designer”, and choose “File -> New Form”. In the opening dialog , choose “Main Window”. In the new window in the edit area, double-click on the existing record “Type Here”. When it become editable, type “&File” and then enter key. Using the same method add a new entry “&Exit” to the “File” menu. Now turn to the “Properties Editor” and rename the item we added. Set the QMenuBar, “File” menu (QMenu), “Exit” menu (QAction) as “m_menubar”, “m_menu_file”, “m_action_quit”, respectively.

Click the “plus icon” in the “Signal/Slot Editor”. Then choose the “Sender” as QAction object “m_action_quit”, the “Signal” as “triggered()”, “Slot” as “MainWindow” and “Slot” as “close()”.
You can change the title of the window in the property “windowTitle” of the window. When you storing, remember that the file name should be the same as the name of the window.
4. Use the UI file in Visual Studio 2005
You should add the ui file to the project before you use it. Click right mouse button on the project, this time, choose “Add -> Existing Item”. In the opening dialog, the “Files of Type” must be set as “All Files (*.*)”. Then choose the UI file previously saved and add it to the project.

When such a UI file is added for the first time, you get a message appears that “A custom build rule to build files with extension ‘*.ui’ could not be found.” Click the “Yes” button and set the dialog. In this example, we set it as:

Display Name:
“QT Build Rule”
File Name
“qt_rules”
Directory
“C:\Qt\4.3.2\VS2005” (the location the build rule file saved)

Then insert a new build rule by clicking the “Add Build Rule…” and set the property as following:
• Command Line:
$(QTDIR)/bin/uic.exe "$(InputPath)" -o ui_$(InputName).h
• Display Name
Compile QT UserInterface File (*.ui)
• Execution Description:
Creating UI File ui\_\$(InputName).h
• File Extensions:
*.ui
• Name:
UI
• Outputs:
ui_$(InputName).h

Click the “Ok” button to save the settings. Now, click the right mouse button on the UI File (this example is MainWindow.ui) and click the “Compile” entry of the pop-menu. So, the UI Compiler will produce a new header file of the source code implementing the window class of the UI file created by the QT Designer.
5. Create the main class
Add two new files, “MainWindow.cpp” and “MainWindow.h” to the project. So the project has the following files:

1. Main.cpp
2. MainWindow.ui
3. MainWindow.h
4. MainWindow.cpp

The following is the source code in the MainWindow.h file:
------------------------------------------------------------------------------------------------------
/***********************MainWindows.h************** **********/
// to avoid multiple class definitions by including this file more than once
// we have to surround the class definition by this compiler flag
#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_
#include "Ui_MainWindow.h"
/**
* Sample MainWindow Class
* The class is a simple implementation of a QDesigner created form file
* defining a simple QMainWindow application
* The class inherits from QMainWindow and Ui_MainWindow. The Ui_MainWindow
* provides the QDesigner part of the implementation, while the QMainWindow
* provides the main functions of a QT Application
*/
class MainWindow : public QMainWindow, protected Ui_MainWindow
{
Q_OBJECT
public:
/**
* Constructor of the MainWindow class
* @param parent this optional parameter defines a parent widget the
created instance will be child of
* @param flags optional parameter defining extra widget options
(see also the QT documentation)
*/
MainWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0);
/**
Destructor of the MainWindow class, defined virtual to guarantee that
the destructor will be called even if the instance of this class is
saved in a variable of a parent class type
*/
virtual ~MainWindow();
};
#endif // end of #ifndef MAINWINDOW_H_
------------------------------------------------------------------------------------------------------
The source code for the MainWindow.cpp file is:
------------------------------------------------------------------------------------------------------
/***********************MainWindows.cpp************ ************/
#include "MainWindow.h"
MainWindow::MainWindow(QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
: QMainWindow(parent, flags)
{
// create gui elements defined in the Ui_MainWindow class
setupUi(this);
}
MainWindow::~MainWindow()
{
// no need to delete child widgets, QT does it all for us
}
----------------------------------------------------------------------------------------------------------------
The Source code for the main.cpp:
-------------------------------------------------------------------------------------------------------
/***********************main.cpp******************* *****/
// Header file to get a new instance of QApplication
#include <Qt/qapplication.h>
// Header file for MainWindow class
#include "MainWindow.h"
int main(int argc, char* argv[])
{
// create a new instance of QApplication with params argc and argv
QApplication app( argc, argv );
// create a new instance of MainWindow with no parent widget
MainWindow mainWindow(0, Qt::Window);
// Shows the widget and its child widgets.
mainWindow.show();
// Enters the main event loop and waits until exit() is called
// or the main widget is destroyed or by default the last window closed,
// and returns the value that was set via to exit()
// (which is 0 if exit() is called via quit()).
return app.exec();
}
-------------------------------------------------------------------------------------------------------


6. Set environment variables and Linker
Click the right button on project and choose “Properties”.
First we need t o set the environment. Then choose the
“Configuration Properties -> All Configurations -> C/C++ -> General” and set the property “Additional Include Directories” as “$(QTDIR)/include”.
Now, we should set the Linker. Choose the “Linker -> Input” and then set “Additional Dependencies”.
In the case of “Debug” Configuration, it’s set as the following:
“qtmaind.lib QtGuid4.lib QtCored4.lib”
And in the case of “Release” Configuration, it’s set as the following:
“qtmain.lib QtGui4.lib QtCore4.lib”
At last set the “Linker -> General -> Additional Library Directories” in the case of “All Configurations” as “$(QTDIR)/lib”.

7. Set The Meta-Object-compiler of QT
Custom the build step of the header file (in this example is MainWindow.h). Right click on the mouse button, and click the menu entry “Properties”. Then choose “Configuration Properties -> Custom Build Step” and set the “Configuration” as “All Configurations”. Now, set the fields as following:
• Command Line:

$(QTDIR)\bin\moc.exe "$(InputPath)" -o "$(InputDir)moc_$(InputName).cpp"

• Description:

Performing moc on $(InputName).h

• Outputs:

$(InputDir)moc_$(InputName).cpp

Now, right-clicking on the header file MainWindow.h can now select “Compile” then Meta Object Compiler does his work. Then add the “moc_MainWindow.cpp” file produced by MOC to the project (right click on the project and select “Add -> Existing Item…”, choose the file to add to the project)
Well the following files could be found in the project:
1. main.cpp
2. MainWindow.ui
3. MainWindow.h
4. MainWindow.cpp
5. moc_MainWindow.cpp

Compile and execute the project. Enjoy it.