我的xp 系统下安装了一个 Qt by Trolltech v4.3.2 (OpenSource)  和vc6.0  ,现在公司需要使用这样的软件平台来做界面,对于我来说还是个新的技术,现在根本就不清楚该怎么用这样两个软件来实现界面效果.请高手给予指点!我现在就想知道,该怎么使用Qt by Trolltech v4.3.2 (OpenSource)?是不是还需要相关的环境变量的配置,等等.....

解决方案 »

  1.   

    为什么要在win下开发,这个本来是用于linux下的啊
      

  2.   

    我现在是用的4.2.2版本在VS2005下开发,编译完成后要设置环境变量的环境变量path 安装目录\bin
    include 安装目录\include
    lib 安装目录\lib8.       当环境变量改变后,怎么知道是否设置正确呢?重新打开命令行, 
     PROMPT:\> qmake -v 
     QMake version: 2.00a 
     Using Qt version 4.1.2 in C:\Qt\4.1.2\lib  PROMPT:\> echo %QMAKESPEC% 
    win32-msvc.net                                                            你的运行结果如果和上面的一样,则表示设置成功。 如果你用VC6.0的话PROMPT:\> echo %QMAKESPEC% 的结果应该是不是win32-msvc.net,具体的教程网上有的,我可以给你提供一点4.1.1的安装过程:
      

  3.   

    Building Qt
    Get and install the Qt source  1. To start, get the source package: Download Qt (Not the one that comes with mingw, get the zip file)  2. Unzip your Qt source to a logical location.
        Here are some suggestions:
          C:\Qt\4.1.1\
          C:\Qt\4.1.1-msvc2005\   (<-- if for instance you plan on using Visual Studio 2005)Get and install the patch that allows Qt to be compiled with Visual Studio compilers  1. Download Image:Qtnode-acs-qt4.1.1.zip  2. Unzip the contents of qtnode-acs-qt4.1.1.zip and place all the files in the qt-node-acs-qt4.1.1 directory into the directory you've put the Qt sources.Open up a command prompt in the Qt source directoryRun cmd.exe however you like, but you must make sure that you have your Visual Studio compiler files in your path.  * If you are using Microsoft Visual Studio 6.0, try running vcvars32.bat from the command-line.
      * If you are using Microsoft Visual Studio .NET or 2005, go into the program group called 'Visual Studio Tools' and run the command prompt shortcut. 
    A simple way to ensure your environment is setup properly is to use to see if nmake.exe is in your path:C:\Qt\4.1.1> nmake /?Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
    Copyright (C) Microsoft Corporation. All rights reserved.Usage: NMAKE @commandfile
        NMAKE [options] [/f makefile] [/x stderrfile] [macrodefs] [targets]Options:....Once you are sure that you have the Visual Studio compiler in your path and you're at the command prompt in the Qt source directory, you are ready to proceed.
    Patching the Qt sources
    If you've installed the patch files from qtnode-acs-qt4.1.1.zip correctly then you should be able to patch the Qt sources by running:C:\Qt\4.1.1> installpatch411.batYou should see a lot of action, which is normal, which shows you all the files being patched:C:\Qt\4.1.1> installpatch411.bat
    patching file qconfigure.bat
    patching file examples/threads/waitconditions/waitconditions.pro
    patching file misc/bcc32pch/Makefile.win32-borland
    patching file misc/bcc32pch/bcc32pch.cpp
    patching file misc/bcc32pch/bcc32pch.pri
    patching file misc/bcc32pch/bcc32pch.pro
    patching file mkspecs/win32-bccx/qmake.conf  [snip]patching file tools/porting/src/rpptreeevaluator.cpp
    patching file tools/porting/src/rpptreewalker.cpp
    patching file tools/porting/src/src.pro
    Press any key to continue . . .
    Now run qconfigure.batYou are now ready for the next step: configuring your Qt install.
    Configuring your Qt install (and building qmake)We will not be using the standard configure.exe that ships with Qt. We will be using qconfigure.bat which was included the qtnode-acs-qt4.1.1.zip file.
    But, if you are not sure on which options you want, run configure.exe with the --help option:configure.exe --helpA list of options will be displayed. Take note of any options you are interested in. Note that by default, static and debug versions of the library are built - this is usually a good thing.Now that you've written down (or mentally noted) which options you want to use, we will run qconfigure.bat. It will in turn call configure.exe with your chosen options.qconfigure.bat requires as the first parameter, one of the following compiler choices:  * msvc   <- if you are using Visual Studio 6.0
      * msvc.net   <- if you are using Visual Studio .NET (2003)
      * msvc2005   <- if you are using Visual Studio 2005 
    After the first option, you can pass qconfigure.bat any of the configure.exe you had previously noted. For instance you may do something like:C:\Qt\4.1.1> qconfigure.bat msvc.net -release -no-stl(This command would produce only the release libraries and would exclude STL support in Qt.)(Note that if you want to build static libraries instead of shared, see Building static)You will be prompted 3 times while running qconfigure.bat:  1. You will be asked to accept the GPL license. Type 'y' followed by <Enter> to continue.
      2. You will then be told that qmake is about to be built. Type 'y' followed by <Enter> to continue. This will take a few moments.
      3. You will then be told that the Makefiles are going to be generated. Type 'y' followed by <Enter> to continue. This will be a short operation. Once qconfigure.bat has completed its work, you will be presented with the following message:====================================================You are now ready to build Qt (msvc2005)If you specified -static, type 'nmake sub-src'
              otherwise, type 'nmake'To start over, type 'nmake distclean'
    and then re-run qconfigure.bat====================================================Building the Qt library
    After configuration and building qmake, you are now ready to build the library. Simply run nmake:C:\Qt\4.1.1> nmakeQt takes a long time to compile. Now's a good time to brew a pot of coffee.(If you've specified -static as one of your configuration options, see Building static)
    Setting up your environmentThere are multiple approaches to this, but this is a foolproof way to ensure that your newly create Qt libs are usable.Prepend the Qt bin directory to your PATH. Depending on where you installed your Qt sources, it may be something like:  * C:\Qt\4.1.1\bin
      * C:\Qt\4.1.1-msvc2005\bin
      * C:\Qt\4.1.1-visual-studio\bin 
      

  4.   

    Ensure that the QMAKESPEC environment variable is set to the appropriate value.  * If you use Visual Studio 6.0, then win32-msvc would be the correct value.
      * If you use Visual Studio .NET (2003), then win32-msvc.net would be the correct value.
      * If you use Visual Studio 2005, then win32-msvc2005 would be the correct value. (Note: this is the recommended practice from qtnode. You can use Qt in other ways with different settings, but this way is foolproof.)To set your environment variables in Windows, please see http://www.cs.usask.ca/grads/wew036/latex/env.htmlNote that you may have to re-open a command window before your settings are changed.
    To check that your PATH is set correctly:C:\> qmake -v
    QMake version: 2.00a
    Using Qt version 4.1.1 in C:\Qt\4.1.1\libTo see if QMAKESPEC is set correctly:C:\> echo %QMAKESPEC%
    win32-msvc2005Testing your installPlease test your install from the command-line first. Follow the Hello World instructions.
    Creating Visual Studio projects{Note: the following works with MS Visual Studio 2005, not tested on other versions - look for an expanded section of this section later}
    To create a project, use the -t and -o options.Normally, (as in the Hello World example), you would simply type:prompt> qmake -project
    prompt> qmakeTo create a .vcproj which will be used by Visual Studio, we will type:prompt> qmake -project -t vcapp -o projectname
    prompt> qmakeWhere projectname would be whatever you like the file to be made. If we ran the command above as written in a directory with some sources, we would end up with a file named:  projectname.vcproj You can then double-click on this vcproj file or simply type its name in the command window and Visual Studio will create an associated .sln file.The -t option was used to specify the template used by qmake. By default, the template is app. The app template creates Makefiles which can be used on the command-line when running nmake. But since we are interest in using the Visual Studio IDE, we will want a vcapp which will give us a .vcproj instead of the regular Makefiles.  Note that you could also use the -tp vc option instead of -t vcapp. This will prepend vc to the default template (which is normally app). Maintaining Visual Studio ProjectsTo add files to your project, you can edit your .pro file and re-run qmake. The only problem is that any customizations to your .sln would be lost when you open up the newly updated .vcprojIs this true? can someone confirm this? Is there a better way to deal with both .pros and .slns?
    Additional InfoThis set of patches has been altered from the Q../Free project. Original download available at: http://sourceforge.net/project/showfiles.php?group_id=49109The changes that were made are:  * the patch file was altered to work with Qt 4.1.1 (patch was originally for 4.1.0)
      * qconfigure.bat was altered so that it:
          o Allows the user to stop the execution before building qmake
          o Allows the user to stop the execution before generating Makefiles
          o Does not automatically call nmake for you. (This is important because if you specified the -static option, you need to be able to run nmake sub-src)
          o added a check for qmake\tmp (when not present this is a problem for some users) Retrieved from "http://www.qtnode.net/wiki/Qt4_with_Visual_Studio"
      

  5.   

    我自己电脑是WINDOW XP; 
    VS2005 + QT 4.4你再安装一个qt.visual.studio.integration.exe
    QT和VS的整合插件。
    -----
    如果你用过C#开发, 那么就直接建立QT的工程, 在新建工程里面选择。添加qt from等等, 就很简单了。