[lazarus] Lazarus QT implementation

Baeseman, Cliff Cliff.Baeseman at greenheck.com
Mon Oct 18 10:58:28 EDT 1999


I have been sitting quietly at home for about 4-5 days now working on a QT
Engine for lazarus. Now before everyone has a fit let me explain a few
things here. First of all the GTK library has way to many limitations and is
in no way polymorphic like the QT implementation is. I have learned in the
last few days just how flexible, stable, fast the QT library is. The QT
library has every thing we need to get a successful class library up and
running very quickly.

The bad thing or good thing depending on how you look at it is that QT is
C++ which means not touchable by FPC. I have a very extendable interface
engine that I built especially for use with FPC or any other language for
that matter.

Here is a little about how it works....


"Messaging calls to the library"
fpc-message -calls-> C Interface -calls-> LazarusQT Engine -> Perform
Message Action on widget in widget list

The C interface to the library is simple
  void * IntSendMessage(int Message, char WidgetID,void * Data, int
DataType, int DataSize)

   so a call to the library to create a button looks like this
     IntSendMessage(MSG_CREATE_BUTTON_WITH_LABEL,'label1','Hello
Button',0,0)


"event hooks calling from the library"
QWidget --> LCL Component WinProc(integer) 


The event hook interface which I am completing now looks like this..
     ProcEventHook(void * FAddress, char WidgetID)  

The event will call a single procedure (per widget) passing a integer as the
event that occured. 

So in free pascal you can hook a event something like this. 

  'first hook the event'
  ProcEventHook(@WinProc,'label1')

  when the label fires a event it will call WinProc and pass the event id.

  procedure WinProc(Message: Integer);
    begin
      case Message of
          MSG_CLICK:    <--then dispatch the call

    end;

  This does of course mean that winprock can be overridden and extended as
necessary at a component level. 

  The drawback but not much of one is that widgets have to be defined in the
library before use. This is very simple to do only 4 lines of code for most
implementations. I was able to add 4 widgets to the engine yesterday in 25
minutes. I have also implemented control reparenting and x, y, height, width
layout. In QT everything is a polymorphic decendant of QObject and all
layout stuff is at that level. This means that X and Y positioning is gravy.

Just wanting to let everyone know what I am up to. I may be able to realese
the base engine to everyone about friday if my wife quits b---ching at me.

Cliff








More information about the Lazarus mailing list