Recent

Author Topic: where qt4pas sources are?  (Read 19594 times)

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: where qt4pas sources are?
« Reply #30 on: January 17, 2016, 05:38:42 am »
Guys is there any QT demo applications not based on lcl? I'm interested in testing various ideas mainly on qt4 on windows and I don't want to bother with all the weirdness of lcl on top of QT.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

mm7

  • Full Member
  • ***
  • Posts: 119
Re: where qt4pas sources are?
« Reply #31 on: January 17, 2016, 06:14:31 pm »
Question regarding naming convention - If there is a class in Qt, let say QtDialog, in Pascal wrapping should we keep same name, or should it be named in Pascal standard TQtDialog ?

Let's keep naming convention from Qt4 bindings.
Qt              Qt4Pas       
QObject -> QObjectH
QWidget -> QWidgetH
QFrame -> QFrameH
etc

In lclqt we have TQtWidget which is pure object pascal implementation and which contains property Widget:QWidgetH.

Qt4Pas is just flat Pascal calls to flat C wrappers shared library. QObjectH are just handlers to Qt objects of those Qt classes.
What I am talking about is a layer of Pascal proxy classes that will reflect Qt C++ classes (and call them).
So using them one can program in Pascal Qt like in C++ Qt.

writing in OOP style
Code: Pascal  [Select]
  1. var d:QDialog;
  2. begin
  3. d:=QDialog.Create();
  4. w:=d.width;
  5.  

instead of flat style
Code: Pascal  [Select]
  1. var dh:dialogH;
  2. begin
  3. QDialog_create(dh);
  4. w:=QDialog_width(dh);
  5.  


Cyrax

  • Hero Member
  • *****
  • Posts: 760
Re: where qt4pas sources are?
« Reply #32 on: January 17, 2016, 06:19:31 pm »
FPC doesn't support directly calling C++ classes. You need to create instance of C++ class from the other side (separate library).

mm7

  • Full Member
  • ***
  • Posts: 119
Re: where qt4pas sources are?
« Reply #33 on: January 17, 2016, 07:22:29 pm »
FPC doesn't support directly calling C++ classes. You need to create instance of C++ class from the other side (separate library).

Sure.

QDialog.width proxy class member will call flat QDialog_width procedure that will call flat C QDialog_width wrapper procedure from shared library that will call C++ QDialog.width class member.

pointer to instance of C++ QDialog will be stored in Pascal QDialog instance.

Callbacks, (pascal procs called by C++ class from the other side) are more complex. But it is also possible. In SWIG there is concept of "director" class for this.

SWIG generates flat C wrappers, flat Pascal procedures, proxy Pascal classes and directors. It should. Currently Modula3, Delphi and Free Pascal (that I am working on) modules are quite rough at this moment.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: where qt4pas sources are?
« Reply #34 on: January 21, 2016, 10:51:08 am »
Qt5 alpha builds on my system with latest Qt 5.5 something. I had to change the minor version and to add printsupport.

Quote from: diff
16c16
< QT += gui network webkitwidgets printsupport
---
> QT += gui network webkitwidgets
34c34
< !equals(QT_MAJOR_VERSION,5)|!equals(QT_MINOR_VERSION,5) {
---
> !equals(QT_MAJOR_VERSION,5)|!equals(QT_MINOR_VERSION,1) {

Quote from: dd libQt5Pas.so
        linux-vdso.so.1 (0x00007ffd8b9ed000)
        libQt5WebKitWidgets.so.5 => /usr/lib/libQt5WebKitWidgets.so.5 (0x00007fd298b06000)
        libQt5PrintSupport.so.5 => /usr/lib/libQt5PrintSupport.so.5 (0x00007fd298a93000)
        libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x00007fd298404000)
        libQt5WebKit.so.5 => /usr/lib/libQt5WebKit.so.5 (0x00007fd295f58000)
        libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x00007fd295a0f000)
        libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x00007fd2958bb000)
        libQt5Core.so.5 => /usr/lib/libQt5Core.so.5
...

No idea how to go ahead now.
Lazarus 1.7 (SVN) FPC 3.0.0

mm7

  • Full Member
  • ***
  • Posts: 119
Re: where qt4pas sources are?
« Reply #35 on: February 01, 2016, 06:35:00 pm »
Update.
I've managed to make SWIG to generate all major C++ types/classes to Pascal.
Downloaded Qt 5 sources.
Currently working on QtCore module....

zeljko

  • Hero Member
  • *****
  • Posts: 1090
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: where qt4pas sources are?
« Reply #36 on: February 01, 2016, 08:27:32 pm »
Update.
I've managed to make SWIG to generate all major C++ types/classes to Pascal.
Downloaded Qt 5 sources.
Currently working on QtCore module....

Nice, good luck  :)