HBQT Tutorial

HBQT-Tutorial
Giovanni Di Maria
May 9, 2011
email: calimero22@yahoo.it



Harbour (2.1) and QT Classes (4.7) - Tutorial
 --------------------------------------------------------------------------
Rev. [1] February 12, 2011 - Rev. [4031] May 9, 2011










Record of Revision


Revision Description
1 Feb 12, 2011
10 Feb 16, 2011
50 Feb 21, 2011
100 Feb 24, 2011
200 Feb 28, 2011
300 Mar 02, 2011
400 Mar 04, 2011
500 Mar 06, 2011
600 Mar 07, 2011
700 Mar 08, 2011
800 Mar 09, 2011
900 Mar 15, 2011
1000 Mar 22, 2011
1100 Mar 23, 2011
1200 Mar 24, 2011
1300 Mar 24, 2011
1400 Mar 30, 2011
1500 Mar 30, 2011
2000 Mar 30, 2011
2500 Mar 30, 2011
3000 Apr 03, 2011
3500 Apr 18, 2011
4000 Apr 21, 2011



Introduction

This tutorial is a brief, continuously updated, of the use of the classes QT with Harbour language.
It is specically written for beginners that initially encountered some difficulties in using these classes, however, extremely powerful and effcient. The approach of the tutorial is di erent from other guides that are online. It simply focuses a single class or single object, so you do not get lost in the maze of the vast les of examples provided with the product. This will easily learn to manage and plan their individual class, as needed, and, nally, to put "together" the whole.

Giovanni Di Maria
email: calimero22@yahoo.it








Notes for developers

  • In order to make good use of the Qt classes, you should see the include le "hbqtgui.ch". The path of this include is (for windows) /hb21/include
  • You should consult the Nokia's offcial documentation
  • You should consult this tutorial in 2-pages mode
  • If possible, you must not use static variables
  • You should disconnect the objects that were attached with the connect method
  • It is strongly recommended to use hbformat tool to format the .prg sources
  • To create a source, you can copy and paste the code to your text editor and save it with .prg extension






Conventions


  • The present tutorial shows small codes about QT classes. It organizes the arguments as follows:
    • Title (Class Name);
    • Brief description of the program;
    • Author's name;
    • { Screenshot of the application;
    • Harbour source .prg;
  • All the sources in this tutorial are formatted with hbformat tool
  • The name of the variables follows these rules:
    • Numeric: nVariableNameClearlyDe ningThePurpose e.g. nWidth, nHeight
    • String: cVariableNameClearlyDe ningThePurpose e.g. cWndTitle, cMenuPrompt
    • Logical: lVariableNameClearlyDe ningThePurpose e.g. lVisible, lChecked
    • Date: dVariableNameClearlyDe ningThePurpose e.g. dToday, dTommorrow
    • Object: oVariableNameClearlyDe ningThePurpose e.g. oWnd, oSize




Compiling in Windows

In order to compile correctly your sources, you must follow this procedure:
  • Create the le named sample.hbp (or other name) as follow:
hbqt.hbc
-w3 -es2
sample.prg
otherprogrs.prg
  • Create your source program, named sample.prg (or other name).
  • Compile with hbmk2 sample.hbp.
  • The procedure will create the le sample.exe.
  • You can distribute your program with the following les:
sample.exe
libgcc s dw2-1.dll
mingwm10.dll
QtCore4.dll
QtGui4.dll

These DLL are located in C:/hb21/bin or in C:/hb21/comp/mingw/bin.