mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 22:59:27 +02:00
Merge branch 'main' into 'main'
Added NativeFilterEvent hook in qt5/qt6 See merge request freepascal.org/lazarus/lazarus!126
This commit is contained in:
commit
70bc333d28
@ -10,13 +10,13 @@
|
||||
|
||||
|
||||
|
||||
# Binding Release Version 1.2.11 against Qt5 5.6 LTS release.
|
||||
# Binding Release Version 1.2.12 against Qt5 5.6 LTS release.
|
||||
# WebKit widgets are disabled until webenginewidgets are implemented.
|
||||
|
||||
VERSION = 1.2.11
|
||||
VERSION = 1.2.12
|
||||
VER_MAJ = 1
|
||||
VER_MIN = 2
|
||||
VER_PAT = 11
|
||||
VER_PAT = 12
|
||||
win32:VERSION_PE_HEADER = 1.2
|
||||
|
||||
QT += gui network printsupport
|
||||
@ -751,5 +751,8 @@ SOURCES += \
|
||||
qtcpsocket_hook_c.cpp \
|
||||
qtcpserver_hook_c.cpp \
|
||||
qnetworkaccessmanager_hook_c.cpp \
|
||||
qnetworkreply_hook_c.cpp
|
||||
qnetworkreply_hook_c.cpp \
|
||||
qnativeeventfilter_hook_c.cpp \
|
||||
qnativeeventfilter_hook.h \
|
||||
qnativeeventfilter_hook_c.h
|
||||
# end of file
|
||||
|
@ -529,4 +529,7 @@ typedef struct QAccessibleEvent__ { PTRINT dummy; } *QAccessibleEventH;
|
||||
typedef struct QAccessibleInterface__ { PTRINT dummy; } *QAccessibleInterfaceH;
|
||||
typedef struct QAccessibleWidget__ { PTRINT dummy; } *QAccessibleWidgetH;
|
||||
typedef struct QLCLAccessibleWidget__ { PTRINT dummy; } *QLCLAccessibleWidgetH;
|
||||
|
||||
typedef struct Q_NativeEventFilter_hook__ { PTRINT dummy; } *Q_NativeEventFilter_hookH;
|
||||
typedef struct Q_NativeEventFilter__ { PTRINT dummy; } *Q_NativeEventFilterH;
|
||||
#endif
|
||||
|
@ -297,4 +297,6 @@ inline void copyQRealArrayToQVectorQReal(PQRealArray parr,QVector<qreal> &qvecto
|
||||
|
||||
C_EXPORT void initializeQRealArray(GetQRealArrayAddr gaa, GetQRealArrayLength gal, SetQRealArrayLength sal);
|
||||
|
||||
typedef bool (*NativeEventFilter)(const QByteArray &eventType, void *message, long *result);
|
||||
|
||||
#endif
|
||||
|
87
lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook.h
Normal file
87
lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook.h
Normal file
@ -0,0 +1,87 @@
|
||||
//******************************************************************************
|
||||
// Copyright (c) 2005-2022 by Matteo Salvi
|
||||
//
|
||||
// See the included file COPYING.TXT for details about the copyright.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef Q_NATIVEEVENTFILTER_HOOK_H
|
||||
#define Q_NATIVEEVENTFILTER_HOOK_H
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qabstractnativeeventfilter.h>
|
||||
#include "pascalbind.h"
|
||||
|
||||
class Q_NativeEventFilter_hook : public QAbstractNativeEventFilter {
|
||||
|
||||
public:
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
|
||||
|
||||
Q_NativeEventFilter_hook(QCoreApplication *handle) : QAbstractNativeEventFilter() {
|
||||
this->handle = handle;
|
||||
this->events.func = NULL;
|
||||
this->destroyed_event.func = NULL;
|
||||
}
|
||||
|
||||
virtual ~Q_NativeEventFilter_hook() {
|
||||
if (handle) {
|
||||
handle->removeNativeEventFilter(this);
|
||||
handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void hook_installfilter(QHook &hook) {
|
||||
if (handle) {
|
||||
if (!events.func) {
|
||||
handle->installNativeEventFilter(this);
|
||||
events = hook;
|
||||
}
|
||||
if (!hook.func)
|
||||
handle->removeNativeEventFilter(this);
|
||||
events = hook;
|
||||
}
|
||||
}
|
||||
void hook_removefilter() {
|
||||
if (handle) {
|
||||
handle->removeNativeEventFilter(this);
|
||||
events.func = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void hook_destroyed(QHook &hook) {
|
||||
destroyed_event = hook;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
QCoreApplication *handle;
|
||||
|
||||
private slots:
|
||||
|
||||
void destroyed_hook() {
|
||||
if ( destroyed_event.func ) {
|
||||
typedef void (*func_type)(void *data);
|
||||
(*(func_type)destroyed_event.func)(destroyed_event.data);
|
||||
}
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
QHook events;
|
||||
QHook destroyed_event;
|
||||
};
|
||||
|
||||
|
||||
bool Q_NativeEventFilter_hook::nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
|
||||
if (events.func) {
|
||||
Q_NativeEventFilter_hook* sender = this;
|
||||
typedef bool (*func_type)(void *data, Q_NativeEventFilter_hook* sender, const QByteArray &eventType, void *message);
|
||||
return (*(func_type)events.func)(events.data, sender, eventType, message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,36 @@
|
||||
//******************************************************************************
|
||||
// Copyright (c) 2005-2022 by Matteo Salvi
|
||||
//
|
||||
// See the included file COPYING.TXT for details about the copyright.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//******************************************************************************
|
||||
|
||||
#include "qnativeeventfilter_hook_c.h"
|
||||
|
||||
Q_NativeEventFilter_hookH Q_NativeEventFilter_hook_Create(QCoreApplicationH handle)
|
||||
{
|
||||
return (Q_NativeEventFilter_hookH) new Q_NativeEventFilter_hook((QCoreApplication*)handle);
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_Destroy(Q_NativeEventFilter_hookH handle)
|
||||
{
|
||||
delete (Q_NativeEventFilter_hook *)handle;
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_installfilter(Q_NativeEventFilter_hookH handle, QHookH hook)
|
||||
{
|
||||
((Q_NativeEventFilter_hook *)handle)->hook_installfilter(hook);
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_destroyed(Q_NativeEventFilter_hookH handle, QHookH hook)
|
||||
{
|
||||
((Q_NativeEventFilter_hook *)handle)->hook_destroyed(hook);
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_removefilter(Q_NativeEventFilter_hookH handle)
|
||||
{
|
||||
((Q_NativeEventFilter_hook *)handle)->hook_removefilter();
|
||||
}
|
23
lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook_c.h
Normal file
23
lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook_c.h
Normal file
@ -0,0 +1,23 @@
|
||||
//******************************************************************************
|
||||
// Copyright (c) 2005-2022 by Matteo Salvi
|
||||
//
|
||||
// See the included file COPYING.TXT for details about the copyright.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef Q_NATIVEEVENTFILTER_HOOK_C_H
|
||||
#define Q_NATIVEEVENTFILTER_HOOK_C_H
|
||||
|
||||
#include "qnativeeventfilter_hook.h"
|
||||
#include "pascalbind.h"
|
||||
|
||||
C_EXPORT Q_NativeEventFilter_hookH Q_NativeEventFilter_hook_Create(QCoreApplicationH handle);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_Destroy(Q_NativeEventFilter_hookH handle);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_installfilter(Q_NativeEventFilter_hookH handle, QHookH hook);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_destroyed(Q_NativeEventFilter_hookH handle, QHookH hook);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_removefilter(Q_NativeEventFilter_hookH handle);
|
||||
|
||||
#endif
|
@ -15672,6 +15672,15 @@ procedure QNetworkReply_hook_hook_encrypted(handle: QNetworkReply_hookH; hook: Q
|
||||
procedure QNetworkReply_hook_hook_uploadProgress(handle: QNetworkReply_hookH; hook: QNetworkReply_uploadProgress_Event); cdecl; external Qt5PasLib name 'QNetworkReply_hook_hook_uploadProgress';
|
||||
procedure QNetworkReply_hook_hook_downloadProgress(handle: QNetworkReply_hookH; hook: QNetworkReply_downloadProgress_Event); cdecl; external Qt5PasLib name 'QNetworkReply_hook_hook_downloadProgress';
|
||||
|
||||
type
|
||||
QNativeEventFilter_hookH = class(TObject) end;
|
||||
QNativeEventFilterEvent = function (handle: QNativeEventFilter_hookH; eventType: QByteArrayH; message: long):boolean of object cdecl;
|
||||
|
||||
function QNativeEventFilter_hook_Create(handle : QCoreApplicationH) : QNativeEventFilter_hookH; cdecl; external Qt5PasLib name 'Q_NativeEventFilter_hook_Create';
|
||||
procedure QNativeEventFilter_Destroy(handle : QNativeEventFilter_hookH ); cdecl; external Qt5PasLib name 'Q_NativeEventFilter_hook_Destroy';
|
||||
procedure QNativeEventFilter_hook_installfilter(handle : QNativeEventFilter_hookH; hook : QNativeEventFilterEvent); cdecl; external Qt5PasLib name 'Q_NativeEventFilter_hook_installfilter';
|
||||
procedure QNativeEventFilter_hook_destroyed(handle : QNativeEventFilter_hookH; hook : QObject_destroyed_Event); cdecl; external Qt5PasLib name 'Q_NativeEventFilter_hook_destroyed';
|
||||
procedure QNativeEventFilter_hook_removefilter(handle : QNativeEventFilter_hookH); cdecl; external Qt5PasLib name 'Q_NativeEventFilter_hook_removefilter';
|
||||
|
||||
|
||||
//=======================================================
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
|
||||
|
||||
# Binding Release Version 6.2.4 against Qt6 6.2 LTS release.
|
||||
# Binding Release Version 6.2.5 against Qt6 6.2 LTS release.
|
||||
|
||||
win32:VERSION = 6.2.4.0
|
||||
else:VERSION = 6.2.4
|
||||
win32:VERSION = 6.2.5.0
|
||||
else:VERSION = 6.2.5
|
||||
VER_MAJ = 6
|
||||
VER_MIN = 2
|
||||
VER_PAT = 4
|
||||
VER_PAT = 5
|
||||
win32:VERSION_PE_HEADER = 6.2
|
||||
|
||||
QT += gui printsupport
|
||||
@ -702,5 +702,8 @@ SOURCES += \
|
||||
qprintpreviewdialog_hook_c.cpp \
|
||||
qprintpreviewwidget_hook_c.cpp \
|
||||
qsystemtrayicon_hook_c.cpp \
|
||||
qgraphicsscene_hook_c.cpp
|
||||
qgraphicsscene_hook_c.cpp \
|
||||
qnativeeventfilter_hook_c.cpp \
|
||||
qnativeeventfilter_hook.h \
|
||||
qnativeeventfilter_hook_c.h
|
||||
# end of file
|
||||
|
@ -485,4 +485,7 @@ typedef struct QAccessibleEvent__ { PTRINT dummy; } *QAccessibleEventH;
|
||||
typedef struct QAccessibleInterface__ { PTRINT dummy; } *QAccessibleInterfaceH;
|
||||
typedef struct QAccessibleWidget__ { PTRINT dummy; } *QAccessibleWidgetH;
|
||||
typedef struct QLCLAccessibleWidget__ { PTRINT dummy; } *QLCLAccessibleWidgetH;
|
||||
|
||||
typedef struct Q_NativeEventFilter_hook__ { PTRINT dummy; } *Q_NativeEventFilter_hookH;
|
||||
typedef struct Q_NativeEventFilter__ { PTRINT dummy; } *Q_NativeEventFilterH;
|
||||
#endif
|
||||
|
@ -300,4 +300,6 @@ inline void copyQRealArrayToQVectorQReal(PQRealArray parr,QVector<qreal> &qvecto
|
||||
|
||||
C_EXPORT void initializeQRealArray(GetQRealArrayAddr gaa, GetQRealArrayLength gal, SetQRealArrayLength sal);
|
||||
|
||||
typedef bool (*NativeEventFilter)(const QByteArray &eventType, void *message, qintptr *result);
|
||||
|
||||
#endif
|
||||
|
87
lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook.h
Normal file
87
lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook.h
Normal file
@ -0,0 +1,87 @@
|
||||
//******************************************************************************
|
||||
// Copyright (c) 2005-2022 by Matteo Salvi
|
||||
//
|
||||
// See the included file COPYING.TXT for details about the copyright.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef Q_NATIVEEVENTFILTER_HOOK_H
|
||||
#define Q_NATIVEEVENTFILTER_HOOK_H
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qabstractnativeeventfilter.h>
|
||||
#include "pascalbind.h"
|
||||
|
||||
class Q_NativeEventFilter_hook : public QAbstractNativeEventFilter {
|
||||
|
||||
public:
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
|
||||
Q_NativeEventFilter_hook(QCoreApplication *handle) : QAbstractNativeEventFilter() {
|
||||
this->handle = handle;
|
||||
this->events.func = NULL;
|
||||
this->destroyed_event.func = NULL;
|
||||
}
|
||||
|
||||
virtual ~Q_NativeEventFilter_hook() {
|
||||
if (handle) {
|
||||
handle->removeNativeEventFilter(this);
|
||||
handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void hook_installfilter(QHook &hook) {
|
||||
if (handle) {
|
||||
if (!events.func) {
|
||||
handle->installNativeEventFilter(this);
|
||||
events = hook;
|
||||
}
|
||||
if (!hook.func)
|
||||
handle->removeNativeEventFilter(this);
|
||||
events = hook;
|
||||
}
|
||||
}
|
||||
void hook_removefilter() {
|
||||
if (handle) {
|
||||
handle->removeNativeEventFilter(this);
|
||||
events.func = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void hook_destroyed(QHook &hook) {
|
||||
destroyed_event = hook;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
QCoreApplication *handle;
|
||||
|
||||
private slots:
|
||||
|
||||
void destroyed_hook() {
|
||||
if ( destroyed_event.func ) {
|
||||
typedef void (*func_type)(void *data);
|
||||
(*(func_type)destroyed_event.func)(destroyed_event.data);
|
||||
}
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
QHook events;
|
||||
QHook destroyed_event;
|
||||
};
|
||||
|
||||
|
||||
bool Q_NativeEventFilter_hook::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) {
|
||||
if (events.func) {
|
||||
Q_NativeEventFilter_hook* sender = this;
|
||||
typedef bool (*func_type)(void *data, Q_NativeEventFilter_hook* sender, const QByteArray &eventType, void *message);
|
||||
return (*(func_type)events.func)(events.data, sender, eventType, message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,36 @@
|
||||
//******************************************************************************
|
||||
// Copyright (c) 2005-2022 by Matteo Salvi
|
||||
//
|
||||
// See the included file COPYING.TXT for details about the copyright.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//******************************************************************************
|
||||
|
||||
#include "qnativeeventfilter_hook_c.h"
|
||||
|
||||
Q_NativeEventFilter_hookH Q_NativeEventFilter_hook_Create(QCoreApplicationH handle)
|
||||
{
|
||||
return (Q_NativeEventFilter_hookH) new Q_NativeEventFilter_hook((QCoreApplication*)handle);
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_Destroy(Q_NativeEventFilter_hookH handle)
|
||||
{
|
||||
delete (Q_NativeEventFilter_hook *)handle;
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_installfilter(Q_NativeEventFilter_hookH handle, QHookH hook)
|
||||
{
|
||||
((Q_NativeEventFilter_hook *)handle)->hook_installfilter(hook);
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_destroyed(Q_NativeEventFilter_hookH handle, QHookH hook)
|
||||
{
|
||||
((Q_NativeEventFilter_hook *)handle)->hook_destroyed(hook);
|
||||
}
|
||||
|
||||
void Q_NativeEventFilter_hook_removefilter(Q_NativeEventFilter_hookH handle)
|
||||
{
|
||||
((Q_NativeEventFilter_hook *)handle)->hook_removefilter();
|
||||
}
|
23
lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook_c.h
Normal file
23
lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook_c.h
Normal file
@ -0,0 +1,23 @@
|
||||
//******************************************************************************
|
||||
// Copyright (c) 2005-2022 by Matteo Salvi
|
||||
//
|
||||
// See the included file COPYING.TXT for details about the copyright.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef Q_NATIVEEVENTFILTER_HOOK_C_H
|
||||
#define Q_NATIVEEVENTFILTER_HOOK_C_H
|
||||
|
||||
#include "qnativeeventfilter_hook.h"
|
||||
#include "pascalbind.h"
|
||||
|
||||
C_EXPORT Q_NativeEventFilter_hookH Q_NativeEventFilter_hook_Create(QCoreApplicationH handle);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_Destroy(Q_NativeEventFilter_hookH handle);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_installfilter(Q_NativeEventFilter_hookH handle, QHookH hook);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_destroyed(Q_NativeEventFilter_hookH handle, QHookH hook);
|
||||
C_EXPORT void Q_NativeEventFilter_hook_removefilter(Q_NativeEventFilter_hookH handle);
|
||||
|
||||
#endif
|
@ -15392,6 +15392,16 @@ procedure QGraphicsScene_hook_hook_sceneRectChanged(handle: QGraphicsScene_hookH
|
||||
procedure QGraphicsScene_hook_hook_selectionChanged(handle: QGraphicsScene_hookH; hook: QGraphicsScene_selectionChanged_Event); cdecl; external Qt6PasLib name 'QGraphicsScene_hook_hook_selectionChanged';
|
||||
procedure QGraphicsScene_hook_hook_focusItemChanged(handle: QGraphicsScene_hookH; hook: QGraphicsScene_focusItemChanged_Event); cdecl; external Qt6PasLib name 'QGraphicsScene_hook_hook_focusItemChanged';
|
||||
|
||||
type
|
||||
QNativeEventFilter_hookH = class(TObject) end;
|
||||
QNativeEventFilterEvent = function (handle: QNativeEventFilter_hookH; eventType: QByteArrayH; message: PtrInt):boolean of object cdecl;
|
||||
|
||||
function QNativeEventFilter_hook_Create(handle : QCoreApplicationH) : QNativeEventFilter_hookH; cdecl; external Qt6PasLib name 'Q_NativeEventFilter_hook_Create';
|
||||
procedure QNativeEventFilter_Destroy(handle : QNativeEventFilter_hookH ); cdecl; external Qt6PasLib name 'Q_NativeEventFilter_hook_Destroy';
|
||||
procedure QNativeEventFilter_hook_installfilter(handle : QNativeEventFilter_hookH; hook : QNativeEventFilterEvent); cdecl; external Qt6PasLib name 'Q_NativeEventFilter_hook_installfilter';
|
||||
procedure QNativeEventFilter_hook_destroyed(handle : QNativeEventFilter_hookH; hook : QObject_destroyed_Event); cdecl; external Qt6PasLib name 'Q_NativeEventFilter_hook_destroyed';
|
||||
procedure QNativeEventFilter_hook_removefilter(handle : QNativeEventFilter_hookH); cdecl; external Qt6PasLib name 'Q_NativeEventFilter_hook_removefilter';
|
||||
|
||||
//=======================================================
|
||||
// Dynamic Qt Version
|
||||
//=======================================================
|
||||
|
Loading…
Reference in New Issue
Block a user