Skip to content

Commit

Permalink
updates from Zeljan, v..8 to v..10, tweek scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbannon committed Nov 21, 2024
1 parent 19b9fbf commit 02d481f
Show file tree
Hide file tree
Showing 24 changed files with 602 additions and 75 deletions.
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ README



**Please Note :** As of early 2024, you probably need these files if you are using Lazarus 3.0 or later. Over time, the various distros will catch up and provide their own version of these libraries.



**NOTE : If you have libraries installed earlier than November 25, 2022, earlier than libqt6pas6_6.2.2-2_amd64.deb then you MUST remove the old before installing the new ones (if and only if you need the new ones). See below section Names and Numbering.**
**Please Note :** As of late 2024, you probably need these files if you are using Lazarus 3.0 or later on a machine without up to date libqt6pas files. Over time, the various distros are catching up and provide their own version of these libraries. If you are using an Arch based Linux, Debian Trixie, latest Fedora, you don't need these files.



Expand All @@ -27,19 +23,19 @@ The packages should work on distributions like Ubuntu 22.04, Fedora 36 and Debia



Its possible that libraries for pacman and for arm and arm64 will appear here if there seems a demand.
Its possible that libraries for pacman and for arm and arm64 will appear here soon.



libqt6pas is an interface between a (Qt6) Lazarus application and the Qt6 libraries. Not all Qt6 functions are available, only those necessary for Lazarus functionality. See https://wiki.freepascal.org/Qt6_Interface
**libqt6pas** is an interface between a (Qt6) Lazarus application and the Qt6 libraries. Not all Qt6 functions are available, only those necessary for Lazarus functionality. See https://wiki.freepascal.org/Qt6_Interface



This is an unofficial copy of the libqt6pas code from the Lazarus Main (aka Trunk, master). It is very new, should be regarded as experimental but does appear to work and is extensivly tested ! At some point in time, the distros will catch up and, if you can, you should use a distro distributed verion of the library. However, its possible that the libraries here will often be ahead of your distro.



The code here will never be ahead of that inthe Lazarus trunk but will track it, superficially tested as changes are made to the relevant content in Lazarus Main.
The code here will never be ahead of that in the Lazarus trunk but will track it, superficially tested as changes are made to the relevant content in Lazarus Main.



Expand Down Expand Up @@ -83,13 +79,26 @@ As almost all users will be using systems with later Qt6 than the origional targ

**Building this Library**
--------


**Updated, Nov 2024**

**(Info for the maintainer.)**



I now build these libraries (for x86-64) on a U20.04 VM to ensure backwards compatibility with glibc. However, U20.04 does not have a suitable Qt6, so, get one from this PPA - http://ppa.launchpad.net/okirby/qt6-backports/ubuntu - a file called /etc/apt/sources.list.d/okirby-ubuntu-qt6-backports-focal.list must contain the following -



deb http://ppa.launchpad.net/okirby/qt6-backports/ubuntu focal main


Start with a clean U2204.

* $> sudo apt install qt6-base-dev alien rpm lintian vim devscripts rpmlint // bit over 400Meg

* $> mkdir ~/Pascal; cd ~/Pascal
* $> mkdir ~/LibQt; cd ~/LibQt

* git clone https://github.com/davidbannon/libqt6pas.git

Expand All @@ -111,11 +120,9 @@ If already setup.



* $> cd ~/Pascal/libqt6pas/cbindings/scripts

* $> bash ./qt6update.bash # this will update your repo directly from the official master.
* $> cd ~/LibQt/libqt6pas/cbindings/scripts

* above script will report, if a new build is necessary, do -
* $> bash ./qt6update.bash # this will update your repo directly from the official master if necessary

* $> cd ../../

Expand All @@ -125,7 +132,7 @@ If already setup.

* update the whatsnew file

* $> EMAIL=[email protected] bash ./package-lib
* $> EMAIL=[email protected] bash ./package-lib # (I use the <tb>@<*.id.au> one



Expand All @@ -137,6 +144,8 @@ Then push code up to this git repo, create a new release page, assign a new (but
--------
* https://opensource.com/article/18/9/how-build-rpm-packages

* https://launchpad.net/~okirby/+archive/ubuntu/qt6-backports // get Qt6 6.2.2 on Ubuntu 20.04




Expand Down
35 changes: 20 additions & 15 deletions README.note
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@

<size:small>Don't edit this markdown file, its generated from the tomboy-ng note.</size:small>

<bold>Please Note :</bold> As of early 2024, you probably need these files if you are using Lazarus 3.0 or later. Over time, the various distros will catch up and provide their own version of these libraries.

<bold>NOTE : If you have libraries installed earlier than November 25, 2022, earlier than libqt6pas6_6.2.2-2_amd64.deb then you MUST remove the old before installing the new ones (if and only if you need the new ones). See below section Names and Numbering.</bold>
<bold>Please Note :</bold> As of late 2024, you probably need these files if you are using Lazarus 3.0 or later on a machine without up to date libqt6pas files. Over time, the various distros are catching up and provide their own version of these libraries. If you are using an Arch based Linux, Debian Trixie, latest Fedora, you don't need these files.

Download packaged libraries (Debs, RPMs and a tar ball) for x86_64 from https://github.com/davidbannon/libqt6pas/releases/latest

The packages should work on distributions like Ubuntu 22.04, Fedora 36 and Debian Bookworm or later. Note that ones like Ubuntu 20.04 for example will not work with these libraries, their official repos do not have Qt6 or a sufficently up to date Qt6.. In practise, you need a Qt6 6.2.4 and GLibc 2.34 or later. But there are no guarantees folks ! Bookworm appears to have settled on Qt6 6.4.2

Its possible that libraries for pacman and for arm and arm64 will appear here if there seems a demand.
Its possible that libraries for pacman and for arm and arm64 will appear here soon.

libqt6pas is an interface between a (Qt6) Lazarus application and the Qt6 libraries. Not all Qt6 functions are available, only those necessary for Lazarus functionality. See https://wiki.freepascal.org/Qt6_Interface
<bold>libqt6pas</bold> is an interface between a (Qt6) Lazarus application and the Qt6 libraries. Not all Qt6 functions are available, only those necessary for Lazarus functionality. See https://wiki.freepascal.org/Qt6_Interface

This is an unofficial copy of the libqt6pas code from the Lazarus Main (aka Trunk, master). It is very new, should be regarded as experimental but does appear to work and is extensivly tested ! At some point in time, the distros will catch up and, if you can, you should use a distro distributed verion of the library. However, its possible that the libraries here will often be ahead of your distro.

The code here will never be ahead of that inthe Lazarus trunk but will track it, superficially tested as changes are made to the relevant content in Lazarus Main.
The code here will never be ahead of that in the Lazarus trunk but will track it, superficially tested as changes are made to the relevant content in Lazarus Main.

Bug reports about the library itself should be submitted to the normal Lazarus bug tracking system, https://gitlab.com/groups/freepascal.org/lazarus/-/issues

Expand All @@ -44,10 +42,17 @@ As almost all users will be using systems with later Qt6 than the origional targ


<size:large><bold>Building this Library</bold></size:large>

<bold>Updated, Nov 2024</bold>
<bold>(Info for the maintainer.)</bold>

I now build these libraries (for x86-64) on a U20.04 VM to ensure backwards compatibility with glibc. However, U20.04 does not have a suitable Qt6, so, get one from this PPA - http://ppa.launchpad.net/okirby/qt6-backports/ubuntu - a file called /etc/apt/sources.list.d/okirby-ubuntu-qt6-backports-focal.list must contain the following -

<monospace>deb http://ppa.launchpad.net/okirby/qt6-backports/ubuntu focal main</monospace>

Start with a clean U2204.
<list><list-item dir="ltr">$&gt; sudo apt install qt6-base-dev alien rpm lintian vim devscripts rpmlint // bit over 400Meg</list-item></list>
<list><list-item dir="ltr">$&gt; mkdir ~/Pascal; cd ~/Pascal</list-item></list>
<list><list-item dir="ltr">$&gt; mkdir ~/LibQt; cd ~/LibQt</list-item></list>
<list><list-item dir="ltr">git clone https://github.com/davidbannon/libqt6pas.git</list-item></list>
<list><list-item dir="ltr">create a ~/.rpmmacro</list-item></list>
<list><list-item dir="ltr"><list><list-item dir="ltr">%_signature gpg</list-item></list></list-item></list>
Expand All @@ -58,19 +63,19 @@ Start with a clean U2204.

If already setup.

<list><list-item dir="ltr">$&gt; cd ~/Pascal/libqt6pas/cbindings/scripts</list-item></list>
<list><list-item dir="ltr">$&gt; bash ./qt6update.bash # this will update your repo directly from the official master.</list-item></list>
<list><list-item dir="ltr">above script will report, if a new build is necessary, do -</list-item></list>
<list><list-item dir="ltr">$&gt; cd ~/LibQt/libqt6pas/cbindings/scripts</list-item></list>
<list><list-item dir="ltr">$&gt; bash ./qt6update.bash # this will update your repo directly from the official master if necessary</list-item></list>
<list><list-item dir="ltr">$&gt; cd ../../</list-item></list>
<list><list-item dir="ltr">$&gt; qmake6; make # wait a long time</list-item></list>
<list><list-item dir="ltr">$&gt; cd package</list-item></list>
<list><list-item dir="ltr">update the whatsnew file</list-item></list>
<list><list-item dir="ltr">$&gt; [email protected] bash ./package-lib</list-item></list>
<list><list-item dir="ltr">$&gt; [email protected] bash ./package-lib # (I use the &lt;tb&gt;@&lt;*.id.au&gt; one</list-item></list>

Then push code up to this git repo, create a new release page, assign a new (but uncreated) tag, upload the new libraries and release.

<size:large><bold>Ref</bold></size:large>
<list><list-item dir="ltr">https://opensource.com/article/18/9/how-build-rpm-packages</list-item></list>
<list><list-item dir="ltr">https://launchpad.net/~okirby/+archive/ubuntu/qt6-backports // get Qt6 6.2.2 on Ubuntu 20.04</list-item></list>



Expand Down Expand Up @@ -123,14 +128,14 @@ Now, push the changes you made to the source earlier back up to github, create a


</note-content></text>
<last-change-date>2024-04-25T21:07:46.7877268+10:00</last-change-date>
<last-metadata-change-date>2024-04-25T21:07:46.7877268+10:00</last-metadata-change-date>
<last-change-date>2024-11-21T17:20:55.8171931+11:00</last-change-date>
<last-metadata-change-date>2024-11-21T17:20:55.8171931+11:00</last-metadata-change-date>
<create-date>2022-11-08T13:46:34.2510486+11:00</create-date>
<cursor-position>1</cursor-position>
<selection-bound-position>1</selection-bound-position>
<width>1000</width>
<height>626</height>
<x>278</x>
<y>45</y>
<x>87</x>
<y>85</y>
<open-on-startup>False</open-on-startup>
</note>
17 changes: 12 additions & 5 deletions cbindings/Qt6Pas.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#******************************************************************************
# Copyright (c) 2005-2022 by Jan Van hijfte, Željan Rikalo
# Copyright (c) 2005-2024 by Jan Van hijfte, Željan Rikalo
#
# See the included file COPYING.TXT for details about the copyright.
#
Expand All @@ -10,13 +10,13 @@



# Binding Release Version 6.2.8 against Qt6 6.2 LTS release.
# Binding Release Version 6.2.10 against Qt6 6.2 LTS release.

win32:VERSION = 6.2.8.0
else:VERSION = 6.2.8
win32:VERSION = 6.2.10.0
else:VERSION = 6.2.10
VER_MAJ = 6
VER_MIN = 2
VER_PAT = 8
VER_PAT = 10
win32:VERSION_PE_HEADER = 6.2

QT += gui printsupport
Expand Down Expand Up @@ -149,6 +149,9 @@ HEADERS += \
qfilesystemwatcher_hook.h \
qpalette_c.h \
qkeysequence_c.h \
qkeycombination_c.h \
qinputmethod_c.h \
qinputmethod_hook.h \
qevent_c.h \
qlclmessageevent_c.h \
qcursor_c.h \
Expand Down Expand Up @@ -381,6 +384,7 @@ HEADERS += \
qstackedlayout_hook_c.h \
qaction_hook_c.h \
qactiongroup_hook_c.h \
qinputmethod_hook_c.h \
qshortcut_hook_c.h \
qabstracttextdocumentlayout_hook_c.h \
qstandarditemmodel_hook_c.h \
Expand Down Expand Up @@ -482,6 +486,8 @@ SOURCES += \
qfilesystemwatcher_c.cpp \
qpalette_c.cpp \
qkeysequence_c.cpp \
qkeycombination_c.cpp \
qinputmethod_c.cpp \
qevent_c.cpp \
qlclmessageevent_c.cpp \
qcursor_c.cpp \
Expand Down Expand Up @@ -645,6 +651,7 @@ SOURCES += \
qstackedlayout_hook_c.cpp \
qaction_hook_c.cpp \
qactiongroup_hook_c.cpp \
qinputmethod_hook_c.cpp \
qshortcut_hook_c.cpp \
qabstracttextdocumentlayout_hook_c.cpp \
qstandarditemmodel_hook_c.cpp \
Expand Down
24 changes: 5 additions & 19 deletions cbindings/package/changelog
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
libqt6pas (6.2.8) unstable; urgency=medium
libqt6pas (6.2.10) unstable; urgency=medium

* Release of new version.
* Update packaging only to support Qt6.2.2 (rather than just Qt6.2.3)
* Fixed wrong QFontMetricsF_forizontalAdvance() output (2024-11-15)
* Fixed bug in bindings (2024-11-21)
* Please see Lazarus at gitlab for further change details.

-- David Bannon <[email protected]> Sun, 20 Oct 2024 11:50:46 +1100
-- David Bannon <[email protected]> Thu, 21 Nov 2024 17:13:50 +1100

libqt6pas (6.2.8) unstable; urgency=medium

* Release of new version.
* Update packaging only to support Qt6.2.2 (rather than just Qt6.2.3)
* Please see Lazarus at gitlab for further change details.

-- David Bannon <[email protected]> Sun, 20 Oct 2024 11:33:45 +1100

libqt6pas (6.2.8) unstable; urgency=medium

* Release of new version.
* Update packaging only to support Qt6.2.2 (rather than just Qt6.2.3)
* Please see Lazarus at gitlab for further change details.

-- David Bannon <dbannon@u2004MnewBuild> Sun, 20 Oct 2024 11:31:10 +1100

libqt6pas (6.2.8) unstable; urgency=medium

* Release of new version.
* Update packaging only to support Qt6.2.2 (rather than just Qt6.2.3)
* Please see Lazarus at gitlab for further change details.

-- David Bannon <dbannon@u2004MnewBuild> Sun, 20 Oct 2024 11:26:31 +1100
-- David Bannon <[email protected]> Sun, 20 Oct 2024 11:31:10 +1100

libqt6pas (6.2.8) unstable; urgency=medium

Expand Down
2 changes: 1 addition & 1 deletion cbindings/package/package-lib
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# The '0' in above will be rev'ed by every change Z makes to the interface, the 6.2 is the LTS Qt6 release


PACKVER='2' # should start at '1', rev if you re-package same binary
PACKVER='1' # should start at '1', rev if you re-package same binary

LIBNAME=libQt6Pas
PRODUCT="libqt6pas6" # note lib has upper case letters, this appears in Package name, two sixes but gets another
Expand Down
13 changes: 10 additions & 3 deletions cbindings/package/scripts/qt6update.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ set -e
# checks version number and if required, updates the relevent files.
# No license, use as you see fit. David Bannon 2022-12-17

GIT_REPO="Pascal/libqt6pas"
# GIT_REPO="Pascal/libqt6pas"
GIT_REPO="$HOME/LibQt/libqt6pas" # this is where the unoffical github repo is replicated
DOWNLOAD="lazarus-main-lcl-interfaces-qt6"
DOWNLOAD_SUBS="lcl/interfaces/qt6"
TAR_FILE="lazarus-main-lcl-interfaces-qt6-cbindings-src.tar.gz"
Expand All @@ -16,13 +17,13 @@ if [ "$DOWNLOAD" == "" ]; then
echo "ERROR - Download dir not defined"
exit
fi
cd
cd # move to my home dir
if [ -e "$TAR_FILE" ]; then
rm "$TAR_FILE"
echo "Removing old download"
fi

if [ -d "$DOWNLOAD" ]; then
if [ -d "$DOWNLOAD" ]; then # clear away an old dir before we download from gitlab
rm -Rf "$DOWNLOAD"
echo "Removing old download dir"
else
Expand All @@ -31,12 +32,18 @@ fi

wget -O "$TAR_FILE" https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/main/lazarus-main.tar.gz?path=lcl/interfaces/qt6
tar xzf "$TAR_FILE"

echo "----- OK, have downloaded, lets check version numbers"
grep VER_PAT "$DOWNLOAD"/"$DOWNLOAD_SUBS"/cbindings/Qt6Pas.pro
grep VER_PAT "$GIT_REPO"/cbindings/Qt6Pas.pro

echo "----- Hope that made sense"

DOWN_VER=`grep VER_PAT "$DOWNLOAD"/"$DOWNLOAD_SUBS"/cbindings/Qt6Pas.pro`
GIT_VER=`grep VER_PAT "$GIT_REPO"/cbindings/Qt6Pas.pro`

echo "----- Comparing $DOWN_VER with $GIt_VER "

if [ "$DOWN_VER" != "$GIT_VER" ]; then
echo "Update required"
rm -Rf "$GIT_REPO"/cbindings/src
Expand Down
3 changes: 2 additions & 1 deletion cbindings/package/whatsnew
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Update packaging only to support Qt6.2.2 (rather than just Qt6.2.3)
Fixed wrong QFontMetricsF_forizontalAdvance() output (2024-11-15)
Fixed bug in bindings (2024-11-21)
2 changes: 1 addition & 1 deletion cbindings/qt62.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8934,7 +8934,7 @@ function QFontMetricsF_overlinePos(handle: QFontMetricsFH): qreal; cdecl; extern
function QFontMetricsF_strikeOutPos(handle: QFontMetricsFH): qreal; cdecl; external Qt6PasLib name 'QFontMetricsF_strikeOutPos';
function QFontMetricsF_lineWidth(handle: QFontMetricsFH): qreal; cdecl; external Qt6PasLib name 'QFontMetricsF_lineWidth';

function QFontMetricsF_horizontalAdvance(handle: QFontMetricsH; AnonParam1: QStringH; len: Integer = -1): integer; cdecl; external Qt6PasLib name 'QFontMetricsF_horizontalAdvance3';
//function QFontMetricsF_horizontalAdvance(handle: QFontMetricsH; AnonParam1: QStringH; len: Integer = -1): integer; cdecl; external Qt6PasLib name 'QFontMetricsF_horizontalAdvance3';
procedure QFontMetricsF_boundingRect(handle: QFontMetricsFH; retval: QRectFH; _string: QStringH); cdecl; external Qt6PasLib name 'QFontMetricsF_boundingRect5';
procedure QFontMetricsF_boundingRect(handle: QFontMetricsFH; retval: QRectFH; r: QRectFH; flags: Integer; _string: QStringH; tabstops: Integer = 0; tabarray: PInteger = nil); cdecl; external Qt6PasLib name 'QFontMetricsF_boundingRect6';
procedure QFontMetricsF_size(handle: QFontMetricsFH; retval: QSizeFH; flags: Integer; str: QStringH; tabstops: Integer = 0; tabarray: PInteger = nil); cdecl; external Qt6PasLib name 'QFontMetricsF_size2';
Expand Down
4 changes: 4 additions & 0 deletions cbindings/src/chandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ typedef struct QWidget__ { PTRINT dummy; } *QWidgetH;
typedef struct QLCLOpenGLWidget__ { PTRINT dummy; } *QLCLOpenGLWidgetH;
typedef struct QRadialGradient__ { PTRINT dummy; } *QRadialGradientH;
typedef struct QStyle__ { PTRINT dummy; } *QStyleH;
typedef struct QCommonStyle__ { PTRINT dummy; } *QCommonStyleH;
typedef struct QLCLProxyStyle__ { PTRINT dummy; } *QLCLProxyStyleH;
typedef struct QFontComboBox_hook__ { PTRINT dummy; } *QFontComboBox_hookH;
typedef struct QWhatsThisClickedEvent__ { PTRINT dummy; } *QWhatsThisClickedEventH;
typedef struct QSwipeGesture__ { PTRINT dummy; } *QSwipeGestureH;
Expand Down Expand Up @@ -125,6 +127,7 @@ typedef struct QPrinter__ { PTRINT dummy; } *QPrinterH;

typedef struct QLCLMessageEvent__ { PTRINT dummy; } *QLCLMessageEventH;
typedef struct QKeySequence__ { PTRINT dummy; } *QKeySequenceH;
typedef struct QKeyCombination__ { PTRINT dummy; } *QKeyCombinationH;
typedef struct QToolBar_hook__ { PTRINT dummy; } *QToolBar_hookH;
typedef struct QStyleOptionComplex__ { PTRINT dummy; } *QStyleOptionComplexH;

Expand Down Expand Up @@ -274,6 +277,7 @@ typedef struct QDragMoveEvent__ { PTRINT dummy; } *QDragMoveEventH;
typedef struct QTabWidget__ { PTRINT dummy; } *QTabWidgetH;
typedef struct QTableWidgetSelectionRange__ { PTRINT dummy; } *QTableWidgetSelectionRangeH;
typedef struct QBrush__ { PTRINT dummy; } *QBrushH;
typedef struct QInputMethod_hook__ { PTRINT dummy; } *QInputMethod_hookH;
typedef struct QInputMethod__ { PTRINT dummy; } *QInputMethodH;
typedef struct QIconEngine__ { PTRINT dummy; } *QIconEngineH;
typedef struct QSplitter__ { PTRINT dummy; } *QSplitterH;
Expand Down
5 changes: 5 additions & 0 deletions cbindings/src/qevent_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,11 @@ quint32 QKeyEvent_nativeModifiers(QKeyEventH handle)
return (quint32) ((QKeyEvent *)handle)->nativeModifiers();
}

void QKeyEvent_keyCombination(QKeyEventH handle, QKeyCombinationH retval)
{
*(QKeyCombination *) retval = ((QKeyEvent *)handle)->keyCombination();
}

QFocusEventH QFocusEvent_Create(QEvent::Type type, Qt::FocusReason reason)
{
return (QFocusEventH) new QFocusEvent(type, reason);
Expand Down
1 change: 1 addition & 0 deletions cbindings/src/qevent_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ C_EXPORT int QKeyEvent_count(QKeyEventH handle);
C_EXPORT quint32 QKeyEvent_nativeScanCode(QKeyEventH handle);
C_EXPORT quint32 QKeyEvent_nativeVirtualKey(QKeyEventH handle);
C_EXPORT quint32 QKeyEvent_nativeModifiers(QKeyEventH handle);
C_EXPORT void QKeyEvent_keyCombination(QKeyEventH handle, QKeyCombinationH retval);
C_EXPORT QFocusEventH QFocusEvent_Create(QEvent::Type type, Qt::FocusReason reason);
C_EXPORT void QFocusEvent_Destroy(QFocusEventH handle);
C_EXPORT bool QFocusEvent_gotFocus(QFocusEventH handle);
Expand Down
Loading

0 comments on commit 02d481f

Please sign in to comment.