[Qt] Release V.172RC

Den Jean Den.Jean at telenet.be
Fri Sep 18 17:49:49 CEST 2009


Zeljko, 
 
http://lists.freepascal.org/lists/fpc-devel/2009-September/017544.html 
http://bugs.freepascal.org/view.php?id=14621 
 
With respect to this I moved from {$mode delphi} to {$mode objfpc}{$H+} 
This allows me in fpc to have better type safe signal 
hooking or method overriding. 
 
The point is to convert this 
==================================================================================== 
var 
  Method          : TMethod; 
... 
  NetworkAccessManagerHook:= 
QNetworkAccessManager_hook_create(QNetworkAccessManager); 
  QNetworkAccessManager_authenticationRequired_Event(Method):=Authenticate; 
  QNetworkAccessManager_hook_hook_authenticationRequired(NetworkAccessManagerHook,Method); 
==================================================================================== 
to this 
==================================================================================== 
  NetworkAccessManagerHook:= 
QNetworkAccessManager_hook_create(QNetworkAccessManager); 
  QNetworkAccessManager_hook_hook_authenticationRequired(NetworkAccessManagerHook, at Authenticate); 
==================================================================================== 
 
 
Release Candidate V1.72RC does this: 
http://users.telenet.be/Jan.Van.hijfte/qtforfpc/qt4pas-V1.72RC_Qt4.5.2.tar.gz 
http://users.telenet.be/Jan.Van.hijfte/qtforfpc/demos-V1.72RC_Qt4.5.2.tar.gz 
 
As I understand that LCL/Qt will need a lot of changes due to this,
I therefore created an automatic converter to do this: 
http://users.telenet.be/Jan.Van.hijfte/qtforfpc/patch_lcl_V1.72.py 
Usage: 
cd /svn/lazarustrunk/lcl/interfaces/qt 
./patch_lcl_V1.72.py 
(and then copy over V1.72RC qt4.pas) 
 
the program will convert most needed changes. 
  * remove declaration of variable method 
  * remove keyword var if not needed anymore 
  * remove assignment to variable method 
  * rewrite hook_hook_something or override_something call 
 
The changed files are back-upped into *.bak 
 
The programs checks that it is run in lcl/interfaces/qt, 
remove this check if you want to convert other code 
 
 
Only one manual change is needed in LCL/Qt qtwidgets.pas (then lazarus 
compiles): 
==================================================================================== 
procedure TQtCustomControl.viewportDelete; 
var 
  NilMethod: TMethod; 
begin 
  if Assigned(FViewPortWidget) then 
  begin 
    FillChar(NilMethod, SizeOf(NilMethod), 0); 
    QLCLAbstractScrollArea_override_viewportEvent(QLCLAbstractScrollAreaH(Widget), 
NilMethod); 
    FreeAndNil(FViewPortWidget); 
  end; 
end; 
==================================================================================== 
into 
==================================================================================== 
procedure TQtCustomControl.viewportDelete; 
begin 
  if Assigned(FViewPortWidget) then 
  begin 
    QLCLAbstractScrollArea_override_viewportEvent(QLCLAbstractScrollAreaH(Widget), 
QLCLAbstractScrollArea_viewportEvent_Override(NilMethod)); 
    FreeAndNil(FViewPortWidget); 
  end; 
end; 
==================================================================================== 
 
There was already a nullhook for that usage defined, I renamed it to nilmethod 
in V1.72RC 
 
If you accept this new method of working for hooking, I will release V1.72 for 
all platforms. 
(probably monday evening) 
 
 
kind regards, 
 
Den Jean 
 
 





More information about the Qt mailing list