Friday, February 11, 2011

Installing Qt on Windows


Step 1: Install the License File (commercial editions only)

If you have the commercial edition of Qt, copy the license file from your account on dist.trolltech.com into your home directory and rename it to .qt-license. This renaming process must be done using a command prompt on Windows

For the open source version you do not need a license file.

Step 2: Unpack the Archive

Uncompress the files into the directory you want Qt installed; e.g. C:\Qt\4.7.1.

Step 3: Set the Environment variables
In order to build and use Qt, the PATH environment variable needs to be extended:
 PATH   - to locate qmake, moc and other Qt tools
This is done by adding c:\Qt\4.7.1\bin to the PATH variable. For newer versions of Windows, PATH can be extended through the Control Panel|System|Advanced|Environment variables menu.

Step 4: Build the Qt Library

To configure the Qt library for your machine, type the following command in a Visual Studio command prompt like:

 C:
cd /D C:\Qt\4.7.1
configure
 
Type configure -help to get a list of all available options
This is done by pasing -platform to configure; for example:
 configure -platform win32-msvc

if you have Visual Studio 2005 installed and want to compile Qt using the x64 compiler because the 32-bit and 64-bit compiler both use the same qmake specification file. This is usually done by selecting Microsoft Visual Studio 2005|Visual Studio Tools| from the Start menu.

Microsoft Visual Studio to create the library and compile all the demos, examples, tools and tutorials type:

               nmake

Qt is now installed.

 

Qt’s Example:

 
#include <qapplication.h>
#include <qpushbutton.h>
 
 
int main( int argc, char **argv )
{
    QApplication a( argc, argv );
 
    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );
 
    a.setMainWidget( &hello );
    hello.show();
    return a.exec();
}


Out put

 

No comments:

Post a Comment