Building Qt Applications using your favorite text editor

I have used C++ for about 5 years now, and it is really a very powerful programming language. But I found one big disadvantage; it is too hard to make a C++ GUI. I used to do that by Windows API, but it is difficult to learn and I can’t learn my students all Windows API concepts for just making some forms and buttons!

Recently I heard about Qt and decided to learn it. As usual I stuck at the beginning; how could I build a Qt Application? and as usual too I do it my way 😉

Building Qt Applications using Notepad

If your favorite text editor is still Notepad!, you must build your Qt Applications using command line.

To let it easy to you, I made a batch file depends on what compiler you want to use to build Qt Applications.

Building Qt Opensource Version using MingW

If you are using Qt Opensource Version you can use this batch file to build and run Qt Applications:

::::::::::::::::::::::: This is Qt building batch by Madhat Alsoos :::::::::::::::::::::::
:: First argument is the directory of the project
:: Second argument is the name of the cpp file without .cpp

@echo off
cd %1
set QTDIR=%1
set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%
set QMAKESPEC=win32-g++
qmake -project
IF not ERRORLEVEL 1 start debug\%2.exe

You can use this batch by passing the directory of the .cpp file and its name like this:

build.bat c:\qt\test\helloworld helloworld

It is so easy! First set Qt base directory to directory of file which we want to build (which will be passed as an argument to this batch file), then add Qt installation directory to the PATH system variable (just in case) and set QMAKESPEC to win32-g++ which tells Qt that it should make the project for g++ compiler. After that we make the .pro file (Qt project file) and compile it using mingw32 (which came by default with your Qt open source verison).

Note that you must change Qt path in this batch to where you installed Qt, or simply add your Qt bin folders to PATH system variable.

Building Qt Commercial Version using Visual Studio

If you are using Qt Commercial Version you can use this batch file to build and run Qt Applications:

Read the rest of this entry »


QtNpp: Notepad++ Plugin to build Qt Applications

I really love Qt and began to learn it recently, but I didn’t find a way to build Qt files from inside Notepad++ so as usual I made mine 😉

QtNpp is my Notepad++ plugin to build and run Qt applications.

Notepad++  Qt

The idea

The idea of QtNpp is simple; just build the file by using these lines:

@echo off
set QTDIR=%1
set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%
set QMAKESPEC=win32-g++
qmake -project

but the implementation of QtNpp is not that simple!

By default QtNpp try to build Qt files by using the above script which works in one of these cases:

Read the rest of this entry »

OpenGL vs. DirectX

 OpenGL              DirectX

I have been using OpenGL for about 4 years until now, it is really a very good library. But I heard a lot about DirectX and many of my students began to learn it, so I decided to do a research about it to know why they need something other than OpenGL?

In my research I read a lot of articles comparing DirectX with OpenGL, but many of them were old, also I didn’t find any article that can tell me everything I want to know. So I created this post to be an exhaustive, up-to-date comparison between OpenGL and DirectX.

I will compare current version of OpenGL which is OpenGL 3.1 with current version of DirectX (or Direct3D if we want to be more exact) which is DirectX 10.

1. Historical View


OpenGL was designed to be a cross platform 2D and 3D Graphics Library, so it doesn’t handle audio or input/output devices but it has many extensions that is made especially to handle this devices. It was developed by Silicon Graphics Incorporated in 1992.

OpenGL is no more than 250 commands which can create, manage and render any complicated scene in many fields like CAD, Virtual Reality, flight simulation and video games.

It is considered a state machine for controlling primitive objects in a scene, so usually programs written in OpenGL are small and efficient.


It was developed by Microsoft in 1995 to be an OpenGL competitive. It is a kind of API handles multimedia and specializes in games field.

It is made of a components like Direct3D (3D graphics library included DirectDraw for 2D draw), DirectMusic and DirectSound.

Nowadays there is not any product that can do all these things that DirectX can do, even though we can find an alternative for every single component.

2. Idea

DirectX was designed to be an Interface for the hardware that is provided by graphics card vendors, so it isn’t hide low details from the user.

Read the rest of this entry »

Install Windows 7 (64 bit) on HP 530 Notebook

Windows Versions

When Windows Vista became pre-release I immediately installed it because of the stories that we heard about it. We all remember that Microsoft says a lot about Windows Vista, so that we believed it will satisfy all our dreams.

But I couldn’t use it more than one month!! I realized that Windows Vista is not stable, beside that it used a lot of RAM comparing to Windows XP, so I felt that I was stupid because I believed Microsoft trivialities about Windows Vista. From that day I stuck with Windows XP and refuse even thinking about changing it!

Now a days, Windows 7 become pre-release and many people (includes IT professionals) says that Windows 7 is the best ever Windows, they always repeat that Windows 7 is the soul of Windows XP with Windows Vista style. So after I heard this story from a lot of my friends I finally decide to try Windows 7

Preparing to Install

I installed Windows 7 Ultimate (64 bit) on my HP 530 Notebook, and realized a lot of people in forums tried to do that on almost the same laptop, so I deiced to add this post to be a step by step tutorial about installing Windows 7 and almost all programs you need on it.
Read the rest of this entry »