Fixed Qt bindings in pya module

This commit is contained in:
Matthias Koefferlein 2023-03-11 01:03:50 +01:00
parent d97942ac3a
commit 18ae970671
15 changed files with 56 additions and 16 deletions

View File

@ -23,14 +23,19 @@
// To force linking of the QtCore module
#include "../../gsiqt/qtbasic/gsiQtCoreExternals.h"
FORCE_LINK_GSI_QTCORE
#undef FORCE_LINK_GSI_QTCORE
#define FORCE_LINK_GSI_QTCORE
// And this is *only* required because of QSignalMapper which takes a QWidget argument from
// the QtGui library and we need to supply the GSI binding for this ...
#include "../../gsiqt/qtbasic/gsiQtGuiExternals.h"
FORCE_LINK_GSI_QTGUI
#undef FORCE_LINK_GSI_QTGUI
#define FORCE_LINK_GSI_QTGUI
// And because we pull in QtGui, we also need to pull in QtWidgets because QtGui bindings
// use QAction and QWidget which are itself in QtWidgets
#include "../../gsiqt/qtbasic/gsiQtWidgetsExternals.h"
FORCE_LINK_GSI_QTWIDGETS
#undef FORCE_LINK_GSI_QTWIDGETS
#define FORCE_LINK_GSI_QTWIDGETS

View File

@ -23,3 +23,6 @@
// To force linking of the QtCore5Compat module
#include "../../gsiqt/qtbasic/gsiQtCore5CompatExternals.h"
FORCE_LINK_GSI_QTCORE5COMPAT
#undef FORCE_LINK_GSI_QTCORE5COMPAT
#define FORCE_LINK_GSI_QTCORE5COMPAT

View File

@ -23,3 +23,5 @@
// To force linking of the QtDesigner module
#include "../../gsiqt/qtbasic/gsiQtDesignerExternals.h"
FORCE_LINK_GSI_QTDESIGNER
#undef FORCE_LINK_GSI_QTDESIGNER
#define FORCE_LINK_GSI_QTDESIGNER

View File

@ -23,8 +23,12 @@
// To force linking of the QtGui module
#include "../../gsiqt/qtbasic/gsiQtGuiExternals.h"
FORCE_LINK_GSI_QTGUI
#undef FORCE_LINK_GSI_QTGUI
#define FORCE_LINK_GSI_QTGUI
// This is required because QAction and QWidget are used are arguments in QtGui, but are
// defined in QtWidgets
#include "../../gsiqt/qtbasic/gsiQtWidgetsExternals.h"
FORCE_LINK_GSI_QTWIDGETS
#undef FORCE_LINK_GSI_QTWIDGETS
#define FORCE_LINK_GSI_QTWIDGETS

View File

@ -23,3 +23,5 @@
// To force linking of the QtNetwork module
#include "../../gsiqt/qtbasic/gsiQtNetworkExternals.h"
FORCE_LINK_GSI_QTNETWORK
#undef FORCE_LINK_GSI_QTNETWORK
#define FORCE_LINK_GSI_QTNETWORK

View File

@ -23,3 +23,5 @@
// To force linking of the QtPrintSupport module
#include "../../gsiqt/qtbasic/gsiQtPrintSupportExternals.h"
FORCE_LINK_GSI_QTPRINTSUPPORT
#undef FORCE_LINK_GSI_QTPRINTSUPPORT
#define FORCE_LINK_GSI_QTPRINTSUPPORT

View File

@ -22,5 +22,5 @@
#include "../pymodHelper.h"
#include "QtSqtMain.h"
#include "QtSqlMain.h"
DEFINE_PYMOD(QtSql, "QtSql", "KLayout/Qt module 'QtSql'")

View File

@ -23,3 +23,5 @@
// To force linking of the QtSql module
#include "../../gsiqt/qtbasic/gsiQtSqlExternals.h"
FORCE_LINK_GSI_QTSQL
#undef FORCE_LINK_GSI_QTSQL
#define FORCE_LINK_GSI_QTSQL

View File

@ -23,3 +23,5 @@
// To force linking of the QtSvg module
#include "../../gsiqt/qtbasic/gsiQtSvgExternals.h"
FORCE_LINK_GSI_QTSVG
#undef FORCE_LINK_GSI_QTSVG
#define FORCE_LINK_GSI_QTSVG

View File

@ -23,7 +23,11 @@
// To force linking of the QtCore module
#include "../../gsiqt/qtbasic/gsiQtCoreExternals.h"
FORCE_LINK_GSI_QTCORE
#undef FORCE_LINK_GSI_QTCORE
#define FORCE_LINK_GSI_QTCORE
# include "../../gsiqt/qtbasic/gsiQtUiToolsExternals.h"
FORCE_LINK_GSI_QTUITOOLS
#undef FORCE_LINK_GSI_QTUITOOLS
#define FORCE_LINK_GSI_QTUITOOLS

View File

@ -23,3 +23,5 @@
// To force linking of the QtWidgets module
#include "../../gsiqt/qtbasic/gsiQtWidgetsExternals.h"
FORCE_LINK_GSI_QTWIDGETS
#undef FORCE_LINK_GSI_QTWIDGETS
#define FORCE_LINK_GSI_QTWIDGETS

View File

@ -23,19 +23,27 @@
// To force linking of the QtXml module
#include "../../gsiqt/qtbasic/gsiQtXmlExternals.h"
FORCE_LINK_GSI_QTXML
#undef FORCE_LINK_GSI_QTXML
#define FORCE_LINK_GSI_QTXML
// To force linking of the QtCore module (some arguments
// are QIODevice or QTextStream)
#include "../../gsiqt/qtbasic/gsiQtCoreExternals.h"
FORCE_LINK_GSI_QTCORE
#undef FORCE_LINK_GSI_QTCORE
#define FORCE_LINK_GSI_QTCORE
// And because will pull in QtCore:
// This is *only* required because of QSignalMapper which takes a QWidget argument from
// the QtGui library and we need to supply the GSI binding for this ...
#include "../../gsiqt/qtbasic/gsiQtGuiExternals.h"
FORCE_LINK_GSI_QTGUI
#undef FORCE_LINK_GSI_QTGUI
#define FORCE_LINK_GSI_QTGUI
// And because we pull in QtGui, we also need to pull in QtWidgets because QtGui bindings
// use QAction and QWidget which are itself in QtWidgets
#include "../../gsiqt/qtbasic/gsiQtWidgetsExternals.h"
FORCE_LINK_GSI_QTWIDGETS
#undef FORCE_LINK_GSI_QTWIDGETS
#define FORCE_LINK_GSI_QTWIDGETS

View File

@ -23,8 +23,12 @@
// To force linking of the QtXmlPatterns module
#include "../../gsiqt/qtbasic/gsiQtXmlPatternsExternals.h"
FORCE_LINK_GSI_QTXMLPATTERNS
#undef FORCE_LINK_GSI_QTXMLPATTERNS
#define FORCE_LINK_GSI_QTXMLPATTERNS
// To force linking of the QtNetwork module (some arguments
// are QNetworkAccessManager)
#include "../../gsiqt/qtbasic/gsiQtNetworkExternals.h"
FORCE_LINK_GSI_QTNETWORK
#undef FORCE_LINK_GSI_QTNETWORK
#define FORCE_LINK_GSI_QTNETWORK

View File

@ -30,37 +30,37 @@
#if defined(HAVE_QT)
# if defined(HAVE_QTBINDINGS)
# include "QtCore/QtCoreMain.h"
# include "QtGui/QtGuiMain.h"
# include "../QtCore/QtCoreMain.h"
# include "../QtGui/QtGuiMain.h"
# if defined(INCLUDE_QTNETWORK)
# include "QtNetwork/QtNetworkMain.h"
# include "../QtNetwork/QtNetworkMain.h"
# endif
# if defined(INCLUDE_QTWIDGETS)
# include "QtWidgets/QtWidgetsMain.h"
# include "../QtWidgets/QtWidgetsMain.h"
# endif
# if defined(INCLUDE_QTPRINTSUPPORT)
# include "QtPrintSupport/QtPrintSupportMain.h"
# include "../QtPrintSupport/QtPrintSupportMain.h"
# endif
# if defined(INCLUDE_QTSVG)
# include "QtSvg/QtSvgMain.h"
# include "../QtSvg/QtSvgMain.h"
# endif
# if defined(INCLUDE_QTXML)
# include "QtXml/QtXmlMain.h"
# include "../QtXml/QtXmlMain.h"
# endif
# if defined(INCLUDE_QTXMLPATTERNS)
# include "QtXmlPatterns/QtXmlPatternsMain.h"
# include "../QtXmlPatterns/QtXmlPatternsMain.h"
# endif
# if defined(INCLUDE_QTSQL)
# include "QtSql/QtSqlMain.h"
# include "../QtSql/QtSqlMain.h"
# endif
# if defined(INCLUDE_QTDESIGNER)
# include "QtDesigner/QtDesignerMain.h"
# include "../QtDesigner/QtDesignerMain.h"
# endif
# if defined(INCLUDE_QTUITOOLS)
# include "QtUiTools/QtUiToolsMain.h"
# include "../QtUiTools/QtUiToolsMain.h"
# endif
# if defined(INCLUDE_QTCORE5COMPAT)
# include "QtCore5Compat/QtCore5CompatMain.h"
# include "../QtCore5Compat/QtCore5CompatMain.h"
# endif
# endif
#endif

View File

@ -2020,11 +2020,11 @@ class BasicTest(unittest.TestCase):
# Hint: QApplication creates some leaks (FT, GTK). Hence it must not be used in the leak_check case ..
if not leak_check:
a = pya.QCoreApplication.instance()
self.assertEqual("<class 'pya.Application'>", str(type(a)))
self.assertEqual("<class 'klayout.pyacore.Application'>", str(type(a)))
qd = pya.QDialog()
pya.QApplication.setActiveWindow(qd)
self.assertEqual(repr(pya.QApplication.activeWindow), repr(qd))
self.assertEqual("<class 'pya.QDialog'>", str(type(pya.QApplication.activeWindow)))
self.assertEqual("<class 'klayout.pyacore.QDialog'>", str(type(pya.QApplication.activeWindow)))
qd._destroy()
self.assertEqual(repr(pya.QApplication.activeWindow), "None")