Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / qt / 2006-11

FreePascal Qt4 binding: Qt 4.2.1 preview

15 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hess, Philip J
to Den Jean

Den,

Your new Win32 libqt4intf.dll doesn't work with Lazarus and the Qt widgetset:

"The procedure entry point QCoreApplication_argc could not be located in the dynamic link library libqt4intf.dll."

The Qt widgetset does work with your 1.21 .dll, but only with FPC 2.0.4. If I compile a program with FPC 2.1.1, I get a "segmentation fault" error.

Thanks.

-Phil

Earlier message 21 lines
-----Original Message----- From: [mailto:] On Behalf Of Den Jean Sent: Thursday, November 16, 2006 6:48 PM To: Subject: [Qt] FreePascal Qt4 binding: Qt 4.2.1 preview Hi, There is a preview (beta) of a Qt 4.2.1 binding for FreePascal: http://users.pandora.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html (only compiled for Linux for the moment) Please report if there any problems compiling existing LCL/Qt code. regards, Den Jean
Den Jean
to Hess, Philip J

On Monday 20 November 2006 16:46, Hess, Philip J wrote:

vacation for a week :-)

Show quoted text 5 lines
Your new Win32 libqt4intf.dll doesn't work with Lazarus and the Qt widgetset: "The procedure entry point QCoreApplication_argc could not be located in the dynamic link library libqt4intf.dll."

reading src/corelib/kernel/qcoreapplication.h I see

#ifdef QT_DEPRECATED
    static int argc() QT_DEPRECATED;
    static char **argv() QT_DEPRECATED;
#endif

I will look into this.

The Qt widgetset does work with your 1.21 .dll, but only with FPC 2.0.4. If I compile a program with FPC 2.1.1, I get a "segmentation fault" error.

FPC 2.1.1 is not stable, so you probably found a bug. The FPC team will love your bug report.
Most probably a bug where parameters are not passed compliant with the ABI.

Which fpc svn version ?
Can you pinpoint which qt4intf call -> then a small fpc qt sample should be made for the bug report.

regards,

Den Jean

Den Jean
to Hess, Philip J: Your new Win32 libqt4intf.dll doesn't work with Lazarus and the Qt widgetset: "The…
Philip J wrote
"The procedure entry point QCoreApplication_argc could not be located in the dynamic link library libqt4intf.dll."

when you create a qt app you provide argc/argv
using the fpc rtl.
Retrieving these variables should be done via fpc rtl. So I do not think the fn is needed.

Using the function QCoreApplication_arguments which replace these deprecated ones, is more work.

regards,

Den Jean

Hess, Philip J
to Den Jean: vacation for a week :-) reading src/corelib/kernel/qcoreapplication.h I see #ifdef…

Den,

I've attached a backtrace of the crash with 1.21 libqt4intf.dll when compiled with FPC 2.1.1 (20061215 snapshot).

Can you take a might be an LCL or Qt widgetset bug or a bug in the .dll instead of an FPC bug. Maybe you can learn something from the backtrace before I post as an FPC bug.

The app does start up and paints the main form's outline, then displays an error message - but this stays up only a fraction of a second before it crashes - too quick for me to read what it says.

Thanks.

-Phil

Earlier message 27 lines
-----Original Message----- From: [mailto:] On Behalf Of Den Jean Sent: Friday, November 24, 2006 4:47 PM To: Items specific to the Qt widget set Subject: Re: [Qt] FreePascal Qt4 binding: Qt 4.2.1 preview On Monday 20 November 2006 16:46, Hess, Philip J wrote: > The Qt widgetset does work with your 1.21 .dll, but only with FPC 2.0.4. > If I compile a program with FPC 2.1.1, I get a "segmentation fault" > error. FPC 2.1.1 is not stable, so you probably found a bug. The FPC team will love your bug report. Most probably a bug where parameters are not passed compliant with the ABI. Which fpc svn version ? Can you pinpoint which qt4intf call -> then a small fpc qt sample should be made for the bug report. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: QtCrashWithFPC211.txt URL: <http://lists.lazarus.freepascal.org/pipermail/qt/attachments/20061220/9fa11a6b/attachment.txt>
Den Jean
to Hess, Philip J
Philip J wrote
Den, I've attached a backtrace of the crash with 1.21 libqt4intf.dll when compiled with FPC 2.1.1 (20061215 snapshot).

I just created Qt 4.2.2 binding which I tested
with fpc 2.0.4 release, latest fpc 2.0.5
and fpc 2.1.1 svn 5657 on all demo programs ->
no problems noted on linux.

When I created the windows version, I will do the same on windows.

Den Jean
to Den Jean
Den Jean wrote
When I created the windows version, I will do the same on windows.

I just tested all demoes with fpc 2.1.1 Rev 5810
on windows with Qt 4.2.2 + Binding V1.26 and noticed no problems

Can you retest if with fpc 2.1.1 Rev >= 5810
to check if there still is a problem before we start digging further.

regards,

Den Jean

Hess, Philip J
to Den Jean

Den,

No difference with today's snapshot:

On Windows, my test program crashes at startup when compiled with 2.1.1, but starts up okay when compiled with 2.0.4. I used your latest libqt4intf.dll and qt4.pas.

Thanks.

-Phil

Earlier message 21 lines
-----Original Message----- From: [mailto:] On Behalf Of Den Jean Sent: Thursday, January 04, 2007 6:21 PM To: Items specific to the Qt widget set Subject: Re: [Qt] FreePascal Qt4 binding: Qt 4.2.1 preview On Wednesday 20 December 2006 22:09, Den Jean wrote: > When I created the windows version, I will do the same on windows. I just tested all demoes with fpc 2.1.1 Rev 5810 on windows with Qt 4.2.2 + Binding V1.26 and noticed no problems Can you retest if with fpc 2.1.1 Rev >= 5810 to check if there still is a problem before we start digging further. regards, Den Jean
Den Jean
to Hess, Philip J
Philip J wrote
On Windows, my test program crashes at startup when compiled with 2.1.1, but starts up okay when compiled with 2.0.4. I used your latest libqt4intf.dll and qt4.pas.

the gdb backtrace does not help much.
I see probably wrong coordinates and a zero DC (probably wrong)

Is is possible to reduce the program source as much as possible (but that it still crashes) and send it to me, please

I can add manually code in the binding to inspect
parameters for correctness. If I see a difference between what pascal receives as parameter values and what
Qt.dll reports in the backtrace -> there is the bug

BOTTOM = 2090114328

#7 0x0046053e in TWINCONTROL__WMPAINT (MSG=
{MSG = 1056, DC = 0, PAINTSTRUCT = 0x0, RESULT = 0}, this=0xeb878) at wincontrol.inc:4718

regards,

Den Jean

Hess, Philip J
to Den Jean

I've attached an example of a simple project that crashes under FPC 2.1.1.

I used the 20070105 Lazarus snapshot with FPC 2.1.1.

I'm using Den's latest libqt4intf.dll (831,488 bytes).

I'm using QtCore4.dll and QtGui4.dll for Qt 4.2.1. And mingwm10.dll (dated 20050113).

It appears as though the number of controls on the form makes a difference. Try removing one of the 4 TBitBtn's from the form and see how it now works.

Thanks.

-Phil

Earlier message 33 lines
-----Original Message----- From: on behalf of Den Jean Sent: Sat 1/6/2007 6:42 AM To: Items specific to the Qt widget set Subject: Re: [Qt] FreePascal Qt4 binding: Qt 4.2.1 preview On Friday 05 January 2007 16:58, Hess, Philip J wrote: > On Windows, my test program crashes at startup when compiled with 2.1.1, > but starts up okay when compiled with 2.0.4. I used your latest > libqt4intf.dll and qt4.pas. the gdb backtrace does not help much. I see probably wrong coordinates and a zero DC (probably wrong) Is is possible to reduce the program source as much as possible (but that it still crashes) and send it to me, please I can add manually code in the binding to inspect parameters for correctness. If I see a difference between what pascal receives as parameter values and what Qt.dll reports in the backtrace -> there is the bug BOTTOM = 2090114328 #7 0x0046053e in TWINCONTROL__WMPAINT (MSG= {MSG = 1056, DC = 0, PAINTSTRUCT = 0x0, RESULT = 0}, this=0xeb878) at wincontrol.inc:4718 regards, Den Jean
Den Jean
to Hess, Philip J: I've attached a backtrace of the crash with 1.21 libqt4intf.dll when compiled with FPC…
Philip J wrote 6 lines
Den, The app does start up and paints the main form's outline, then displays an error message - but this stays up only a fraction of a second before it crashes - too quick for me to read what it says.

I spent some time debugging it.
At some point an invalid Qt handle was passed
to the library, but where this handle became
corrupted was not clear.

constructor TQtDeviceContext.Create(WidgetHandle: THandle);
....
    Parent := TQtWidget(WidgetHandle).Widget;
    Widget := QPainter_create(QWidget_to_QPaintDevice(Parent));

The parent value obtained with the type cast for the 4th button of the demo project was invalid. (pointer value way different than with the other buttons.

With fpc 2.0.5 no problem, but with fpc 2.1.1 problems. After update of svn of today for both fpc 211 and lazarus & qt, the problem is gone. I am not sure where the problem was: fpc or lcl/qt

I hope it doesn't come back :-)

Hess, Philip J
to Den Jean

Yes, I think this has been fixed. I haven't seen this problem for a couple weeks now.

Thanks.

-Phil

Earlier message 33 lines
-----Original Message----- From: on behalf of Den Jean Sent: Sun 1/28/2007 1:10 PM To: Items specific to the Qt widget set Subject: Re: [Qt] FreePascal Qt4 binding: Qt 4.2.1 preview On Wednesday 20 December 2006 19:08, Hess, Philip J wrote: > Den, > > The app does start up and paints the main form's outline, then displays > an error message - but this stays up only a fraction of a second before > it crashes - too quick for me to read what it says. > I spent some time debugging it. At some point an invalid Qt handle was passed to the library, but where this handle became corrupted was not clear. constructor TQtDeviceContext.Create(WidgetHandle: THandle); .... Parent := TQtWidget(WidgetHandle).Widget; Widget := QPainter_create(QWidget_to_QPaintDevice(Parent)); The parent value obtained with the type cast for the 4th button of the demo project was invalid. (pointer value way different than with the other buttons. With fpc 2.0.5 no problem, but with fpc 2.1.1 problems. After update of svn of today for both fpc 211 and lazarus & qt, the problem is gone. I am not sure where the problem was: fpc or lcl/qt I hope it doesn't come back :-)
Hess, Philip J
to Den Jean: I spent some time debugging it. At some point an invalid Qt handle was passed to the…

Here's a fix for the tab order problem in the Qt widgetset. Also delete the SortListByTabOrder function since it isn't needed anymore.

Thanks.

procedure TQtMainWindow.setTabOrders;
var
  i: Integer;
  Form: TForm;
  List: TFPList;
begin
  Form := TForm(LCLObject);
  List := TFPList.Create;
  Form.GetTabOrderList(List);
  for i := 0 to List.Count - 2 do
  begin
    setTabOrder(TQtWidget(TWinControl(List.Items[i]).Handle),
     TQtWidget(TWinControl(List.Items[i + 1]).Handle));
    {$ifdef VerboseQt}
      WriteLn('Setting Tab Order first: ', TWinControl(List.Items[i]).Name, ' second: ',
       TWinControl(List.Items[i + 1]).Name);
    {$endif}
  end;
  { The last element points to the first }
  if List.Count > 1 then
  begin
    setTabOrder(TQtWidget(TWinControl(List.Items[List.Count - 1]).Handle),
     TQtWidget(TWinControl(List.Items[0]).Handle));
    {$ifdef VerboseQt}
      WriteLn('Setting Tab Order first: ', TWinControl(List.Items[List.Count - 1]).Name, ' second: ',
       TWinControl(List.Items[0]).Name);
    {$endif}
  end;
  List.Free;
end;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 2774 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/qt/attachments/20070128/6ecd6b7c/attachment.bin>