#730: providing a new Qt module named QtUiTools for QUiLoader class s… (#735)

* #730: providing a new Qt module named QtUiTools for QUiLoader class support.

* Fixed a compile error on Mac

* Added QtUiTools to some more places

* Fixed a linker issue in the QtUiTools Python lib

* On occasion fixed a infinite recursion problem in the debugger

The recursion happened because by mistake I instantiated a
QApplication inside an in-application Python script. This
crashed the debugger due to infinite recursion. This is not
a real use case but to prevent similar issues, a recursion
sentinel was added.

* Removed QCoreApplication#notify from script bindings

Reasoning: "notify" made standalone scripts using QApplication and
QUiLoader virtually impossible.

Problem description:
- When a QApplication object is instantiated, e.g. in Python, the Qt binding
  will install reimplementation hooks as the object may be dynamically
  extended.
- A notify is virtual this means the *every* "notify" call in the application
  is routed through the interpreter.
- For one thing this will slow down the application
- But as "notify" is called a zillion times this has more than this side effect.
- Specifically "notify" is called from within the QWidget constructor to
  indicate a new widget. Then, if a QDialog for example is instatiated, it's
  base class constructor will call "notify" when the object isn't ready yet.
- This has another severe side effect: as the object isn't ready yet, it gets
  registered in the Python space with the wrong class and QDialog is not visible
  as such.

To mitigate these problems, the most efficient solution is to disable "notify"
in general. There is hardly any use case in a script environment (in C++,
apart from hacking the only reasonable use case is exception handling, but
this does not apply to scripts). For providing the call functionality of
"notify" you should better use "postEvent" or "sendEvent" anyway.

So farewell QCoreApplication.notify ...

* Fixed python test for QtUiTools module

* Fixed UiTools test on Qt4 - QUiLoader needs an application object

Co-authored-by: Kazunari Sekigawa <kazunari.sekigawa@gmail.com>
This commit is contained in:
Matthias Köfferlein 2021-02-25 21:29:21 +01:00 committed by GitHub
parent 8b2ecf41df
commit b968f2b47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 2843 additions and 381 deletions

1
.gitignore vendored
View File

@ -36,6 +36,7 @@
build-*
bin-*
mkqtdecl.tmp
mkqtdecl5.tmp
testtmp
*build.macos*
*bin.macos*

View File

@ -49,8 +49,8 @@ inst_dir5=`pwd`/scripts/mkqtdecl5
src_dir=`pwd`/src
src_name4=gsiqt/qt4
src_name5=gsiqt/qt5
qt_mods4="QtCore QtGui QtDesigner QtNetwork QtSql QtXml"
qt_mods5="QtCore QtGui QtWidgets QtDesigner QtNetwork QtPrintSupport QtSql QtSvg QtXml QtXmlPatterns QtMultimedia"
qt_mods4="QtCore QtGui QtDesigner QtNetwork QtSql QtXml QtUiTools"
qt_mods5="QtCore QtGui QtWidgets QtDesigner QtNetwork QtPrintSupport QtSql QtSvg QtXml QtXmlPatterns QtMultimedia QtUiTools"
src_name=$src_name4
inst_dir=$inst_dir4

View File

@ -0,0 +1 @@
#include "QtUiTools/QUiLoader"

View File

@ -302,6 +302,13 @@ rename "QProcess", /QProcess::finished\(int[\s\w]*\)/, "finished_int" # disambig
drop_method "QCoreApplication", /QCoreApplication::QCoreApplication/
add_native_qapp_ctor_impl("QCoreApplication")
# Reasoning: "notify" is hardly needed (use postEvent or sendEvent instead). Reimplementing remains as a use case.
# Reimplementing this method however is questionable: providing an reimplementation hook has severe consequences as even
# Qt object constructors will route over this slot and invoke interpreter calls. This will for example lead to preliminary
# binding of Qt objects to Python objects, hence spoil their object identity.
drop_method "QCoreApplication", /QCoreApplication::notify/
drop_method "QApplication", /QApplication::notify/
# alternative implementation for QObject::findChild
add_native_impl_QObject_findChild
@ -886,6 +893,11 @@ no_copy_ctor "QFormLayout"
no_copy_ctor "QXmlParseException"
no_copy_ctor "QNetworkAccessManager"
# --------------------------------------------------------------
# QtUiTools
include "QUiLoader", [ "<QUiLoader>", "<QDir>", "<QAction>", "<QActionGroup>", "<QLayout>", "<QWidget>", "<QChildEvent>", "<QEvent>", "<QTimerEvent>" ]
# --------------------------------------------------------------
# events and properties
# NOTE: to generate these files use scripts/mkqtdecl/mkqtdecl_extract_props.rb

View File

@ -0,0 +1 @@
#include "QtUiTools/QUiLoader"

View File

@ -375,6 +375,14 @@ rename "QProcess", /QProcess::finished\(int[\s\w]*\)/, "finished_int" # disambig
drop_method "QCoreApplication", /QCoreApplication::QCoreApplication/
add_native_qapp_ctor_impl("QCoreApplication")
# Reasoning: "notify" is hardly needed (use postEvent or sendEvent instead). Reimplementing remains as a use case.
# Reimplementing this method however is questionable: providing an reimplementation hook has severe consequences as even
# Qt object constructors will route over this slot and invoke interpreter calls. This will for example lead to preliminary
# binding of Qt objects to Python objects, hence spoil their object identity.
drop_method "QCoreApplication", /QCoreApplication::notify/
drop_method "QApplication", /QApplication::notify/
drop_method "QGuiApplication", /QGuiApplication::notify/
# alternative implementation for QObject::findChild
add_native_impl_QObject_findChild
@ -1210,6 +1218,11 @@ rename "QNetworkSession", /QNetworkSession::error\(QNetworkSession::/, "error_si
rename "QSqlDriver", /QSqlDriver::notification\(const\s+QString\s*\&\s*\w*\s*\)/, "notification" # disambiguator
rename "QSqlDriver", /QSqlDriver::notification\(const\s+QString\s*\&\s*\w*\s*,/, "notification_withData" # disambiguator
# --------------------------------------------------------------
# QtUiTools
include "QUiLoader", [ "<QUiLoader>", "<QDir>", "<QAction>", "<QActionGroup>", "<QLayout>", "<QWidget>", "<QChildEvent>", "<QEvent>", "<QTimerEvent>" ]
# --------------------------------------------------------------
# events and properties
# NOTE: to generate these files use scripts/mkqtdecl/mkqtdecl_extract_props.rb

View File

@ -77,28 +77,6 @@ static void _call_f_filterEvent_2477 (const qt_gsi::GenericMethod * /*decl*/, vo
}
// bool QCoreApplication::notify(QObject *, QEvent *)
static void _init_f_notify_2411 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_f_notify_2411 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = gsi::arg_reader<QObject * >() (args, heap);
QEvent *arg2 = gsi::arg_reader<QEvent * >() (args, heap);
ret.write<bool > ((bool)((QCoreApplication *)cls)->notify (arg1, arg2));
}
// static void QCoreApplication::addLibraryPath(const QString &)
@ -941,7 +919,6 @@ static gsi::Methods methods_QCoreApplication () {
gsi::Methods methods;
methods += new qt_gsi::GenericStaticMethod ("staticMetaObject", "@brief Obtains the static MetaObject for this class.", &_init_smo, &_call_smo);
methods += new qt_gsi::GenericMethod ("filterEvent", "@brief Method bool QCoreApplication::filterEvent(void *message, long int *result)\n", false, &_init_f_filterEvent_2477, &_call_f_filterEvent_2477);
methods += new qt_gsi::GenericMethod ("notify", "@brief Method bool QCoreApplication::notify(QObject *, QEvent *)\n", false, &_init_f_notify_2411, &_call_f_notify_2411);
methods += gsi::qt_signal ("aboutToQuit()", "aboutToQuit", "@brief Signal declaration for QCoreApplication::aboutToQuit()\nYou can bind a procedure to this signal.");
methods += gsi::qt_signal<QObject * > ("destroyed(QObject *)", "destroyed", gsi::arg("arg1"), "@brief Signal declaration for QCoreApplication::destroyed(QObject *)\nYou can bind a procedure to this signal.");
methods += gsi::qt_signal<int > ("unixSignal(int)", "unixSignal", gsi::arg("arg1"), "@brief Signal declaration for QCoreApplication::unixSignal(int)\nYou can bind a procedure to this signal.");
@ -1054,21 +1031,6 @@ public:
}
}
// [adaptor impl] bool QCoreApplication::notify(QObject *, QEvent *)
bool cbs_notify_2411_0(QObject *arg1, QEvent *arg2)
{
return QCoreApplication::notify(arg1, arg2);
}
virtual bool notify(QObject *arg1, QEvent *arg2)
{
if (cb_notify_2411_0.can_issue()) {
return cb_notify_2411_0.issue<QCoreApplication_Adaptor, bool, QObject *, QEvent *>(&QCoreApplication_Adaptor::cbs_notify_2411_0, arg1, arg2);
} else {
return QCoreApplication::notify(arg1, arg2);
}
}
// [emitter impl] void QCoreApplication::aboutToQuit()
void emitter_QCoreApplication_aboutToQuit_0()
{
@ -1163,7 +1125,6 @@ public:
}
gsi::Callback cb_eventFilter_2411_0;
gsi::Callback cb_notify_2411_0;
gsi::Callback cb_childEvent_1701_0;
gsi::Callback cb_customEvent_1217_0;
gsi::Callback cb_disconnectNotify_1731_0;
@ -1326,32 +1287,6 @@ static void _set_callback_cbs_eventFilter_2411_0 (void *cls, const gsi::Callback
}
// bool QCoreApplication::notify(QObject *, QEvent *)
static void _init_cbs_notify_2411_0 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_cbs_notify_2411_0 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = args.read<QObject * > (heap);
QEvent *arg2 = args.read<QEvent * > (heap);
ret.write<bool > ((bool)((QCoreApplication_Adaptor *)cls)->cbs_notify_2411_0 (arg1, arg2));
}
static void _set_callback_cbs_notify_2411_0 (void *cls, const gsi::Callback &cb)
{
((QCoreApplication_Adaptor *)cls)->cb_notify_2411_0 = cb;
}
// exposed int QCoreApplication::receivers(const char *signal)
static void _init_fp_receivers_c1731 (qt_gsi::GenericMethod *decl)
@ -1445,8 +1380,6 @@ static gsi::Methods methods_QCoreApplication_Adaptor () {
methods += new qt_gsi::GenericMethod ("*event", "@hide", false, &_init_cbs_event_1217_0, &_call_cbs_event_1217_0, &_set_callback_cbs_event_1217_0);
methods += new qt_gsi::GenericMethod ("eventFilter", "@brief Virtual method bool QCoreApplication::eventFilter(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_eventFilter_2411_0, &_call_cbs_eventFilter_2411_0);
methods += new qt_gsi::GenericMethod ("eventFilter", "@hide", false, &_init_cbs_eventFilter_2411_0, &_call_cbs_eventFilter_2411_0, &_set_callback_cbs_eventFilter_2411_0);
methods += new qt_gsi::GenericMethod ("notify", "@brief Virtual method bool QCoreApplication::notify(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("notify", "@hide", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0, &_set_callback_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("*receivers", "@brief Method int QCoreApplication::receivers(const char *signal)\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_receivers_c1731, &_call_fp_receivers_c1731);
methods += new qt_gsi::GenericMethod ("*sender", "@brief Method QObject *QCoreApplication::sender()\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_sender_c0, &_call_fp_sender_c0);
methods += new qt_gsi::GenericMethod ("*timerEvent", "@brief Virtual method void QCoreApplication::timerEvent(QTimerEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_timerEvent_1730_0, &_call_cbs_timerEvent_1730_0);

View File

@ -101,28 +101,6 @@ static void _call_f_isSessionRestored_c0 (const qt_gsi::GenericMethod * /*decl*/
}
// bool QApplication::notify(QObject *, QEvent *)
static void _init_f_notify_2411 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_f_notify_2411 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = gsi::arg_reader<QObject * >() (args, heap);
QEvent *arg2 = gsi::arg_reader<QEvent * >() (args, heap);
ret.write<bool > ((bool)((QApplication *)cls)->notify (arg1, arg2));
}
// QString QApplication::sessionId()
@ -1534,7 +1512,6 @@ static gsi::Methods methods_QApplication () {
methods += new qt_gsi::GenericMethod (":autoSipEnabled", "@brief Method bool QApplication::autoSipEnabled()\n", true, &_init_f_autoSipEnabled_c0, &_call_f_autoSipEnabled_c0);
methods += new qt_gsi::GenericMethod (":inputContext", "@brief Method QInputContext *QApplication::inputContext()\n", true, &_init_f_inputContext_c0, &_call_f_inputContext_c0);
methods += new qt_gsi::GenericMethod ("isSessionRestored?", "@brief Method bool QApplication::isSessionRestored()\n", true, &_init_f_isSessionRestored_c0, &_call_f_isSessionRestored_c0);
methods += new qt_gsi::GenericMethod ("notify", "@brief Method bool QApplication::notify(QObject *, QEvent *)\nThis is a reimplementation of QCoreApplication::notify", false, &_init_f_notify_2411, &_call_f_notify_2411);
methods += new qt_gsi::GenericMethod ("sessionId", "@brief Method QString QApplication::sessionId()\n", true, &_init_f_sessionId_c0, &_call_f_sessionId_c0);
methods += new qt_gsi::GenericMethod ("sessionKey", "@brief Method QString QApplication::sessionKey()\n", true, &_init_f_sessionKey_c0, &_call_f_sessionKey_c0);
methods += new qt_gsi::GenericMethod ("setAutoSipEnabled|autoSipEnabled=", "@brief Method void QApplication::setAutoSipEnabled(const bool enabled)\n", false, &_init_f_setAutoSipEnabled_1559, &_call_f_setAutoSipEnabled_1559);
@ -1686,21 +1663,6 @@ public:
}
}
// [adaptor impl] bool QApplication::notify(QObject *, QEvent *)
bool cbs_notify_2411_0(QObject *arg1, QEvent *arg2)
{
return QApplication::notify(arg1, arg2);
}
virtual bool notify(QObject *arg1, QEvent *arg2)
{
if (cb_notify_2411_0.can_issue()) {
return cb_notify_2411_0.issue<QApplication_Adaptor, bool, QObject *, QEvent *>(&QApplication_Adaptor::cbs_notify_2411_0, arg1, arg2);
} else {
return QApplication::notify(arg1, arg2);
}
}
// [emitter impl] void QApplication::aboutToQuit()
void emitter_QApplication_aboutToQuit_0()
{
@ -1813,7 +1775,6 @@ public:
}
gsi::Callback cb_eventFilter_2411_0;
gsi::Callback cb_notify_2411_0;
gsi::Callback cb_childEvent_1701_0;
gsi::Callback cb_customEvent_1217_0;
gsi::Callback cb_disconnectNotify_1731_0;
@ -2025,32 +1986,6 @@ static void _call_emitter_lastWindowClosed_0 (const qt_gsi::GenericMethod * /*de
}
// bool QApplication::notify(QObject *, QEvent *)
static void _init_cbs_notify_2411_0 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_cbs_notify_2411_0 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = args.read<QObject * > (heap);
QEvent *arg2 = args.read<QEvent * > (heap);
ret.write<bool > ((bool)((QApplication_Adaptor *)cls)->cbs_notify_2411_0 (arg1, arg2));
}
static void _set_callback_cbs_notify_2411_0 (void *cls, const gsi::Callback &cb)
{
((QApplication_Adaptor *)cls)->cb_notify_2411_0 = cb;
}
// exposed int QApplication::receivers(const char *signal)
static void _init_fp_receivers_c1731 (qt_gsi::GenericMethod *decl)
@ -2147,8 +2082,6 @@ static gsi::Methods methods_QApplication_Adaptor () {
methods += new qt_gsi::GenericMethod ("emit_focusChanged", "@brief Emitter for signal void QApplication::focusChanged(QWidget *old, QWidget *now)\nCall this method to emit this signal.", false, &_init_emitter_focusChanged_2522, &_call_emitter_focusChanged_2522);
methods += new qt_gsi::GenericMethod ("emit_fontDatabaseChanged", "@brief Emitter for signal void QApplication::fontDatabaseChanged()\nCall this method to emit this signal.", false, &_init_emitter_fontDatabaseChanged_0, &_call_emitter_fontDatabaseChanged_0);
methods += new qt_gsi::GenericMethod ("emit_lastWindowClosed", "@brief Emitter for signal void QApplication::lastWindowClosed()\nCall this method to emit this signal.", false, &_init_emitter_lastWindowClosed_0, &_call_emitter_lastWindowClosed_0);
methods += new qt_gsi::GenericMethod ("notify", "@brief Virtual method bool QApplication::notify(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("notify", "@hide", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0, &_set_callback_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("*receivers", "@brief Method int QApplication::receivers(const char *signal)\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_receivers_c1731, &_call_fp_receivers_c1731);
methods += new qt_gsi::GenericMethod ("*sender", "@brief Method QObject *QApplication::sender()\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_sender_c0, &_call_fp_sender_c0);
methods += new qt_gsi::GenericMethod ("*timerEvent", "@brief Virtual method void QApplication::timerEvent(QTimerEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_timerEvent_1730_0, &_call_cbs_timerEvent_1730_0);

View File

@ -0,0 +1,13 @@
#
# Partial QMAKE project file for Qt bindings
#
# DO NOT EDIT THIS FILE.
# This file has been created automatically
#
SOURCES += \
gsiQtUiToolsMain.cc \
$$PWD/gsiDeclQUiLoader.cc
HEADERS += gsiQtUiToolsCommon.h

View File

@ -0,0 +1,20 @@
DESTDIR = $$OUT_PWD/../../..
TARGET = klayout_QtUiTools
include($$PWD/../../../lib.pri)
DEFINES += MAKE_GSI_QTUITOOLS_LIBRARY
INCLUDEPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
SOURCES += \
HEADERS += \
include(QtUiTools.pri)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,86 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2021 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file generated/gsiDeclQtUiToolsTypeTraits.h
* @brief Type traits for the Qt binding classes
*
* DO NOT EDIT THIS FILE.
* This file has been created automatically
*/
#ifndef _HDR_gsiDeclQtUiToolsTypeTraits
#define _HDR_gsiDeclQtUiToolsTypeTraits
#include "gsiTypes.h"
struct QMetaObject;
namespace tl {
template <> struct type_traits<QMetaObject> : public type_traits<void> {
};
}
class QObject;
namespace tl {
template <> struct type_traits<QObject> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QObject_Adaptor;
namespace tl {
template <> struct type_traits<QObject_Adaptor> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QSysInfo;
namespace tl {
template <> struct type_traits<QSysInfo> : public type_traits<void> {
};
}
class QUiLoader;
namespace tl {
template <> struct type_traits<QUiLoader> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QUiLoader_Adaptor;
namespace tl {
template <> struct type_traits<QUiLoader_Adaptor> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class Qt_Namespace;
namespace tl {
template <> struct type_traits<Qt_Namespace> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -0,0 +1,48 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2021 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
External declarations for for Qt bindings
DO NOT EDIT THIS FILE.
This file has been created automatically
*/
#if !defined(HDR_gsiQtUiToolsExternals)
#define HDR_gsiQtUiToolsExternals
#include "gsiClass.h"
#include "gsiQtUiToolsCommon.h"
class QUiLoader;
namespace tl { template <> struct type_traits<QUiLoader> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
}; }
namespace gsi { GSI_QTUITOOLS_PUBLIC gsi::Class<QUiLoader> &qtdecl_QUiLoader (); }
#define QT_EXTERNAL_BASE(X) gsi::qtdecl_##X(),
#endif

View File

@ -0,0 +1,25 @@
/**
* Common header for Qt binding definition library
*
* DO NOT EDIT THIS FILE.
* This file has been created automatically
*/
#include "tlDefs.h"
#if !defined(HDR_gsiQtUiToolsCommon_h)
# define HDR_gsiQtUiToolsCommon_h
# ifdef MAKE_GSI_QTUITOOLS_LIBRARY
# define GSI_QTUITOOLS_PUBLIC DEF_INSIDE_PUBLIC
# define GSI_QTUITOOLS_PUBLIC_TEMPLATE DEF_INSIDE_PUBLIC_TEMPLATE
# define GSI_QTUITOOLS_LOCAL DEF_INSIDE_LOCAL
# else
# define GSI_QTUITOOLS_PUBLIC DEF_OUTSIDE_PUBLIC
# define GSI_QTUITOOLS_PUBLIC_TEMPLATE DEF_OUTSIDE_PUBLIC_TEMPLATE
# define GSI_QTUITOOLS_LOCAL DEF_OUTSIDE_LOCAL
# endif
#define FORCE_LINK_GSI_QTUITOOLS GSI_QTUITOOLS_PUBLIC int _force_link_gsiQtUiTools_f (); int _force_link_gsiQtUiTools = _force_link_gsiQtUiTools_f ();
#endif

View File

@ -0,0 +1,11 @@
/**
* Main source file for Qt binding definition library
*
* DO NOT EDIT THIS FILE.
* This file has been created automatically
*/
#include "gsiQtUiToolsCommon.h"
GSI_QTUITOOLS_PUBLIC int _force_link_gsiQtUiTools_f () { return 0; }

View File

@ -7,10 +7,12 @@ SUBDIRS = \
QtXml \
QtSql \
QtNetwork \
QtDesigner
QtDesigner \
QtUiTools
QtGui.depends += QtCore
QtNetwork.depends += QtCore
QtSql.depends += QtCore
QtDesigner.depends += QtCore
QtXml.depends += QtCore
QtUiTools.depends += QtCore

View File

@ -72,28 +72,6 @@ static void _call_f_installNativeEventFilter_3266 (const qt_gsi::GenericMethod *
}
// bool QCoreApplication::notify(QObject *, QEvent *)
static void _init_f_notify_2411 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_f_notify_2411 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = gsi::arg_reader<QObject * >() (args, heap);
QEvent *arg2 = gsi::arg_reader<QEvent * >() (args, heap);
ret.write<bool > ((bool)((QCoreApplication *)cls)->notify (arg1, arg2));
}
// void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObj)
@ -924,7 +902,6 @@ static gsi::Methods methods_QCoreApplication () {
gsi::Methods methods;
methods += new qt_gsi::GenericStaticMethod ("staticMetaObject", "@brief Obtains the static MetaObject for this class.", &_init_smo, &_call_smo);
methods += new qt_gsi::GenericMethod ("installNativeEventFilter", "@brief Method void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filterObj)\n", false, &_init_f_installNativeEventFilter_3266, &_call_f_installNativeEventFilter_3266);
methods += new qt_gsi::GenericMethod ("notify", "@brief Method bool QCoreApplication::notify(QObject *, QEvent *)\n", false, &_init_f_notify_2411, &_call_f_notify_2411);
methods += new qt_gsi::GenericMethod ("removeNativeEventFilter", "@brief Method void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObj)\n", false, &_init_f_removeNativeEventFilter_3266, &_call_f_removeNativeEventFilter_3266);
methods += gsi::qt_signal ("aboutToQuit()", "aboutToQuit", "@brief Signal declaration for QCoreApplication::aboutToQuit()\nYou can bind a procedure to this signal.");
methods += gsi::qt_signal ("applicationNameChanged()", "applicationNameChanged", "@brief Signal declaration for QCoreApplication::applicationNameChanged()\nYou can bind a procedure to this signal.");
@ -1076,21 +1053,6 @@ public:
}
}
// [adaptor impl] bool QCoreApplication::notify(QObject *, QEvent *)
bool cbs_notify_2411_0(QObject *arg1, QEvent *arg2)
{
return QCoreApplication::notify(arg1, arg2);
}
virtual bool notify(QObject *arg1, QEvent *arg2)
{
if (cb_notify_2411_0.can_issue()) {
return cb_notify_2411_0.issue<QCoreApplication_Adaptor, bool, QObject *, QEvent *>(&QCoreApplication_Adaptor::cbs_notify_2411_0, arg1, arg2);
} else {
return QCoreApplication::notify(arg1, arg2);
}
}
// [emitter impl] void QCoreApplication::objectNameChanged(const QString &objectName)
void emitter_QCoreApplication_objectNameChanged_4567(const QString &objectName)
{
@ -1186,7 +1148,6 @@ public:
}
gsi::Callback cb_eventFilter_2411_0;
gsi::Callback cb_notify_2411_0;
gsi::Callback cb_childEvent_1701_0;
gsi::Callback cb_customEvent_1217_0;
gsi::Callback cb_disconnectNotify_2394_0;
@ -1395,32 +1356,6 @@ static void _call_fp_isSignalConnected_c2394 (const qt_gsi::GenericMethod * /*de
}
// bool QCoreApplication::notify(QObject *, QEvent *)
static void _init_cbs_notify_2411_0 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_cbs_notify_2411_0 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = args.read<QObject * > (heap);
QEvent *arg2 = args.read<QEvent * > (heap);
ret.write<bool > ((bool)((QCoreApplication_Adaptor *)cls)->cbs_notify_2411_0 (arg1, arg2));
}
static void _set_callback_cbs_notify_2411_0 (void *cls, const gsi::Callback &cb)
{
((QCoreApplication_Adaptor *)cls)->cb_notify_2411_0 = cb;
}
// emitter void QCoreApplication::objectNameChanged(const QString &objectName)
static void _init_emitter_objectNameChanged_4567 (qt_gsi::GenericMethod *decl)
@ -1559,8 +1494,6 @@ static gsi::Methods methods_QCoreApplication_Adaptor () {
methods += new qt_gsi::GenericMethod ("eventFilter", "@brief Virtual method bool QCoreApplication::eventFilter(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_eventFilter_2411_0, &_call_cbs_eventFilter_2411_0);
methods += new qt_gsi::GenericMethod ("eventFilter", "@hide", false, &_init_cbs_eventFilter_2411_0, &_call_cbs_eventFilter_2411_0, &_set_callback_cbs_eventFilter_2411_0);
methods += new qt_gsi::GenericMethod ("*isSignalConnected", "@brief Method bool QCoreApplication::isSignalConnected(const QMetaMethod &signal)\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_isSignalConnected_c2394, &_call_fp_isSignalConnected_c2394);
methods += new qt_gsi::GenericMethod ("notify", "@brief Virtual method bool QCoreApplication::notify(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("notify", "@hide", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0, &_set_callback_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("emit_objectNameChanged", "@brief Emitter for signal void QCoreApplication::objectNameChanged(const QString &objectName)\nCall this method to emit this signal.", false, &_init_emitter_objectNameChanged_4567, &_call_emitter_objectNameChanged_4567);
methods += new qt_gsi::GenericMethod ("emit_organizationDomainChanged", "@brief Emitter for signal void QCoreApplication::organizationDomainChanged()\nCall this method to emit this signal.", false, &_init_emitter_organizationDomainChanged_0, &_call_emitter_organizationDomainChanged_0);
methods += new qt_gsi::GenericMethod ("emit_organizationNameChanged", "@brief Emitter for signal void QCoreApplication::organizationNameChanged()\nCall this method to emit this signal.", false, &_init_emitter_organizationNameChanged_0, &_call_emitter_organizationNameChanged_0);

View File

@ -99,28 +99,6 @@ static void _call_f_isSessionRestored_c0 (const qt_gsi::GenericMethod * /*decl*/
}
// bool QGuiApplication::notify(QObject *, QEvent *)
static void _init_f_notify_2411 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_f_notify_2411 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = gsi::arg_reader<QObject * >() (args, heap);
QEvent *arg2 = gsi::arg_reader<QEvent * >() (args, heap);
ret.write<bool > ((bool)((QGuiApplication *)cls)->notify (arg1, arg2));
}
// QString QGuiApplication::sessionId()
@ -831,7 +809,6 @@ static gsi::Methods methods_QGuiApplication () {
methods += new qt_gsi::GenericMethod ("devicePixelRatio", "@brief Method double QGuiApplication::devicePixelRatio()\n", true, &_init_f_devicePixelRatio_c0, &_call_f_devicePixelRatio_c0);
methods += new qt_gsi::GenericMethod ("isSavingSession?", "@brief Method bool QGuiApplication::isSavingSession()\n", true, &_init_f_isSavingSession_c0, &_call_f_isSavingSession_c0);
methods += new qt_gsi::GenericMethod ("isSessionRestored?", "@brief Method bool QGuiApplication::isSessionRestored()\n", true, &_init_f_isSessionRestored_c0, &_call_f_isSessionRestored_c0);
methods += new qt_gsi::GenericMethod ("notify", "@brief Method bool QGuiApplication::notify(QObject *, QEvent *)\nThis is a reimplementation of QCoreApplication::notify", false, &_init_f_notify_2411, &_call_f_notify_2411);
methods += new qt_gsi::GenericMethod ("sessionId", "@brief Method QString QGuiApplication::sessionId()\n", true, &_init_f_sessionId_c0, &_call_f_sessionId_c0);
methods += new qt_gsi::GenericMethod ("sessionKey", "@brief Method QString QGuiApplication::sessionKey()\n", true, &_init_f_sessionKey_c0, &_call_f_sessionKey_c0);
methods += gsi::qt_signal ("aboutToQuit()", "aboutToQuit", "@brief Signal declaration for QGuiApplication::aboutToQuit()\nYou can bind a procedure to this signal.");
@ -1034,21 +1011,6 @@ public:
emit QGuiApplication::layoutDirectionChanged(direction);
}
// [adaptor impl] bool QGuiApplication::notify(QObject *, QEvent *)
bool cbs_notify_2411_0(QObject *arg1, QEvent *arg2)
{
return QGuiApplication::notify(arg1, arg2);
}
virtual bool notify(QObject *arg1, QEvent *arg2)
{
if (cb_notify_2411_0.can_issue()) {
return cb_notify_2411_0.issue<QGuiApplication_Adaptor, bool, QObject *, QEvent *>(&QGuiApplication_Adaptor::cbs_notify_2411_0, arg1, arg2);
} else {
return QGuiApplication::notify(arg1, arg2);
}
}
// [emitter impl] void QGuiApplication::objectNameChanged(const QString &objectName)
void emitter_QGuiApplication_objectNameChanged_4567(const QString &objectName)
{
@ -1168,7 +1130,6 @@ public:
}
gsi::Callback cb_eventFilter_2411_0;
gsi::Callback cb_notify_2411_0;
gsi::Callback cb_childEvent_1701_0;
gsi::Callback cb_customEvent_1217_0;
gsi::Callback cb_disconnectNotify_2394_0;
@ -1495,32 +1456,6 @@ static void _call_emitter_layoutDirectionChanged_2316 (const qt_gsi::GenericMeth
}
// bool QGuiApplication::notify(QObject *, QEvent *)
static void _init_cbs_notify_2411_0 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_cbs_notify_2411_0 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = args.read<QObject * > (heap);
QEvent *arg2 = args.read<QEvent * > (heap);
ret.write<bool > ((bool)((QGuiApplication_Adaptor *)cls)->cbs_notify_2411_0 (arg1, arg2));
}
static void _set_callback_cbs_notify_2411_0 (void *cls, const gsi::Callback &cb)
{
((QGuiApplication_Adaptor *)cls)->cb_notify_2411_0 = cb;
}
// emitter void QGuiApplication::objectNameChanged(const QString &objectName)
static void _init_emitter_objectNameChanged_4567 (qt_gsi::GenericMethod *decl)
@ -1738,8 +1673,6 @@ static gsi::Methods methods_QGuiApplication_Adaptor () {
methods += new qt_gsi::GenericMethod ("*isSignalConnected", "@brief Method bool QGuiApplication::isSignalConnected(const QMetaMethod &signal)\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_isSignalConnected_c2394, &_call_fp_isSignalConnected_c2394);
methods += new qt_gsi::GenericMethod ("emit_lastWindowClosed", "@brief Emitter for signal void QGuiApplication::lastWindowClosed()\nCall this method to emit this signal.", false, &_init_emitter_lastWindowClosed_0, &_call_emitter_lastWindowClosed_0);
methods += new qt_gsi::GenericMethod ("emit_layoutDirectionChanged", "@brief Emitter for signal void QGuiApplication::layoutDirectionChanged(Qt::LayoutDirection direction)\nCall this method to emit this signal.", false, &_init_emitter_layoutDirectionChanged_2316, &_call_emitter_layoutDirectionChanged_2316);
methods += new qt_gsi::GenericMethod ("notify", "@brief Virtual method bool QGuiApplication::notify(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("notify", "@hide", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0, &_set_callback_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("emit_objectNameChanged", "@brief Emitter for signal void QGuiApplication::objectNameChanged(const QString &objectName)\nCall this method to emit this signal.", false, &_init_emitter_objectNameChanged_4567, &_call_emitter_objectNameChanged_4567);
methods += new qt_gsi::GenericMethod ("emit_organizationDomainChanged", "@brief Emitter for signal void QGuiApplication::organizationDomainChanged()\nCall this method to emit this signal.", false, &_init_emitter_organizationDomainChanged_0, &_call_emitter_organizationDomainChanged_0);
methods += new qt_gsi::GenericMethod ("emit_organizationNameChanged", "@brief Emitter for signal void QGuiApplication::organizationNameChanged()\nCall this method to emit this signal.", false, &_init_emitter_organizationNameChanged_0, &_call_emitter_organizationNameChanged_0);

View File

@ -0,0 +1,13 @@
#
# Partial QMAKE project file for Qt bindings
#
# DO NOT EDIT THIS FILE.
# This file has been created automatically
#
SOURCES += \
gsiQtUiToolsMain.cc \
$$PWD/gsiDeclQUiLoader.cc
HEADERS += gsiQtUiToolsCommon.h

View File

@ -0,0 +1,20 @@
DESTDIR = $$OUT_PWD/../../..
TARGET = klayout_QtUiTools
include($$PWD/../../../lib.pri)
DEFINES += MAKE_GSI_QTUITOOLS_LIBRARY
INCLUDEPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
SOURCES += \
HEADERS += \
include(QtUiTools.pri)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,138 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2021 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file generated/gsiDeclQtUiToolsTypeTraits.h
* @brief Type traits for the Qt binding classes
*
* DO NOT EDIT THIS FILE.
* This file has been created automatically
*/
#ifndef _HDR_gsiDeclQtUiToolsTypeTraits
#define _HDR_gsiDeclQtUiToolsTypeTraits
#include "gsiTypes.h"
struct QByteArrayDataPtr;
namespace tl {
template <> struct type_traits<QByteArrayDataPtr> : public type_traits<void> {
};
}
class QMessageLogContext;
namespace tl {
template <> struct type_traits<QMessageLogContext> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QMessageLogger;
namespace tl {
template <> struct type_traits<QMessageLogger> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
struct QMetaObject;
namespace tl {
template <> struct type_traits<QMetaObject> : public type_traits<void> {
};
}
#include <QMetaObject>
namespace tl {
template <> struct type_traits<QMetaObject::Connection> : public type_traits<void> {
};
}
class QObject;
namespace tl {
template <> struct type_traits<QObject> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QObject_Adaptor;
namespace tl {
template <> struct type_traits<QObject_Adaptor> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QRegExp;
namespace tl {
template <> struct type_traits<QRegExp> : public type_traits<void> {
};
}
class QSignalBlocker;
namespace tl {
template <> struct type_traits<QSignalBlocker> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
struct QStringDataPtr;
namespace tl {
template <> struct type_traits<QStringDataPtr> : public type_traits<void> {
};
}
class QStringMatcher;
namespace tl {
template <> struct type_traits<QStringMatcher> : public type_traits<void> {
};
}
class QSysInfo;
namespace tl {
template <> struct type_traits<QSysInfo> : public type_traits<void> {
};
}
class QUiLoader;
namespace tl {
template <> struct type_traits<QUiLoader> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class QUiLoader_Adaptor;
namespace tl {
template <> struct type_traits<QUiLoader_Adaptor> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
class Qt_Namespace;
namespace tl {
template <> struct type_traits<Qt_Namespace> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -0,0 +1,48 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2021 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
External declarations for for Qt bindings
DO NOT EDIT THIS FILE.
This file has been created automatically
*/
#if !defined(HDR_gsiQtUiToolsExternals)
#define HDR_gsiQtUiToolsExternals
#include "gsiClass.h"
#include "gsiQtUiToolsCommon.h"
class QUiLoader;
namespace tl { template <> struct type_traits<QUiLoader> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
}; }
namespace gsi { GSI_QTUITOOLS_PUBLIC gsi::Class<QUiLoader> &qtdecl_QUiLoader (); }
#define QT_EXTERNAL_BASE(X) gsi::qtdecl_##X(),
#endif

View File

@ -0,0 +1,25 @@
/**
* Common header for Qt binding definition library
*
* DO NOT EDIT THIS FILE.
* This file has been created automatically
*/
#include "tlDefs.h"
#if !defined(HDR_gsiQtUiToolsCommon_h)
# define HDR_gsiQtUiToolsCommon_h
# ifdef MAKE_GSI_QTUITOOLS_LIBRARY
# define GSI_QTUITOOLS_PUBLIC DEF_INSIDE_PUBLIC
# define GSI_QTUITOOLS_PUBLIC_TEMPLATE DEF_INSIDE_PUBLIC_TEMPLATE
# define GSI_QTUITOOLS_LOCAL DEF_INSIDE_LOCAL
# else
# define GSI_QTUITOOLS_PUBLIC DEF_OUTSIDE_PUBLIC
# define GSI_QTUITOOLS_PUBLIC_TEMPLATE DEF_OUTSIDE_PUBLIC_TEMPLATE
# define GSI_QTUITOOLS_LOCAL DEF_OUTSIDE_LOCAL
# endif
#define FORCE_LINK_GSI_QTUITOOLS GSI_QTUITOOLS_PUBLIC int _force_link_gsiQtUiTools_f (); int _force_link_gsiQtUiTools = _force_link_gsiQtUiTools_f ();
#endif

View File

@ -0,0 +1,11 @@
/**
* Main source file for Qt binding definition library
*
* DO NOT EDIT THIS FILE.
* This file has been created automatically
*/
#include "gsiQtUiToolsCommon.h"
GSI_QTUITOOLS_PUBLIC int _force_link_gsiQtUiTools_f () { return 0; }

View File

@ -69,28 +69,6 @@ static void _call_f_autoSipEnabled_c0 (const qt_gsi::GenericMethod * /*decl*/, v
}
// bool QApplication::notify(QObject *, QEvent *)
static void _init_f_notify_2411 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_f_notify_2411 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = gsi::arg_reader<QObject * >() (args, heap);
QEvent *arg2 = gsi::arg_reader<QEvent * >() (args, heap);
ret.write<bool > ((bool)((QApplication *)cls)->notify (arg1, arg2));
}
// void QApplication::setAutoSipEnabled(const bool enabled)
@ -1074,7 +1052,6 @@ static gsi::Methods methods_QApplication () {
gsi::Methods methods;
methods += new qt_gsi::GenericStaticMethod ("staticMetaObject", "@brief Obtains the static MetaObject for this class.", &_init_smo, &_call_smo);
methods += new qt_gsi::GenericMethod (":autoSipEnabled", "@brief Method bool QApplication::autoSipEnabled()\n", true, &_init_f_autoSipEnabled_c0, &_call_f_autoSipEnabled_c0);
methods += new qt_gsi::GenericMethod ("notify", "@brief Method bool QApplication::notify(QObject *, QEvent *)\nThis is a reimplementation of QGuiApplication::notify", false, &_init_f_notify_2411, &_call_f_notify_2411);
methods += new qt_gsi::GenericMethod ("setAutoSipEnabled|autoSipEnabled=", "@brief Method void QApplication::setAutoSipEnabled(const bool enabled)\n", false, &_init_f_setAutoSipEnabled_1559, &_call_f_setAutoSipEnabled_1559);
methods += new qt_gsi::GenericMethod ("setStyleSheet|styleSheet=", "@brief Method void QApplication::setStyleSheet(const QString &sheet)\n", false, &_init_f_setStyleSheet_2025, &_call_f_setStyleSheet_2025);
methods += new qt_gsi::GenericMethod (":styleSheet", "@brief Method QString QApplication::styleSheet()\n", true, &_init_f_styleSheet_c0, &_call_f_styleSheet_c0);
@ -1296,21 +1273,6 @@ public:
emit QApplication::layoutDirectionChanged(direction);
}
// [adaptor impl] bool QApplication::notify(QObject *, QEvent *)
bool cbs_notify_2411_0(QObject *arg1, QEvent *arg2)
{
return QApplication::notify(arg1, arg2);
}
virtual bool notify(QObject *arg1, QEvent *arg2)
{
if (cb_notify_2411_0.can_issue()) {
return cb_notify_2411_0.issue<QApplication_Adaptor, bool, QObject *, QEvent *>(&QApplication_Adaptor::cbs_notify_2411_0, arg1, arg2);
} else {
return QApplication::notify(arg1, arg2);
}
}
// [emitter impl] void QApplication::objectNameChanged(const QString &objectName)
void emitter_QApplication_objectNameChanged_4567(const QString &objectName)
{
@ -1430,7 +1392,6 @@ public:
}
gsi::Callback cb_eventFilter_2411_0;
gsi::Callback cb_notify_2411_0;
gsi::Callback cb_childEvent_1701_0;
gsi::Callback cb_customEvent_1217_0;
gsi::Callback cb_disconnectNotify_2394_0;
@ -1778,32 +1739,6 @@ static void _call_emitter_layoutDirectionChanged_2316 (const qt_gsi::GenericMeth
}
// bool QApplication::notify(QObject *, QEvent *)
static void _init_cbs_notify_2411_0 (qt_gsi::GenericMethod *decl)
{
static gsi::ArgSpecBase argspec_0 ("arg1");
decl->add_arg<QObject * > (argspec_0);
static gsi::ArgSpecBase argspec_1 ("arg2");
decl->add_arg<QEvent * > (argspec_1);
decl->set_return<bool > ();
}
static void _call_cbs_notify_2411_0 (const qt_gsi::GenericMethod * /*decl*/, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret)
{
__SUPPRESS_UNUSED_WARNING(args);
tl::Heap heap;
QObject *arg1 = args.read<QObject * > (heap);
QEvent *arg2 = args.read<QEvent * > (heap);
ret.write<bool > ((bool)((QApplication_Adaptor *)cls)->cbs_notify_2411_0 (arg1, arg2));
}
static void _set_callback_cbs_notify_2411_0 (void *cls, const gsi::Callback &cb)
{
((QApplication_Adaptor *)cls)->cb_notify_2411_0 = cb;
}
// emitter void QApplication::objectNameChanged(const QString &objectName)
static void _init_emitter_objectNameChanged_4567 (qt_gsi::GenericMethod *decl)
@ -2022,8 +1957,6 @@ static gsi::Methods methods_QApplication_Adaptor () {
methods += new qt_gsi::GenericMethod ("*isSignalConnected", "@brief Method bool QApplication::isSignalConnected(const QMetaMethod &signal)\nThis method is protected and can only be called from inside a derived class.", true, &_init_fp_isSignalConnected_c2394, &_call_fp_isSignalConnected_c2394);
methods += new qt_gsi::GenericMethod ("emit_lastWindowClosed", "@brief Emitter for signal void QApplication::lastWindowClosed()\nCall this method to emit this signal.", false, &_init_emitter_lastWindowClosed_0, &_call_emitter_lastWindowClosed_0);
methods += new qt_gsi::GenericMethod ("emit_layoutDirectionChanged", "@brief Emitter for signal void QApplication::layoutDirectionChanged(Qt::LayoutDirection direction)\nCall this method to emit this signal.", false, &_init_emitter_layoutDirectionChanged_2316, &_call_emitter_layoutDirectionChanged_2316);
methods += new qt_gsi::GenericMethod ("notify", "@brief Virtual method bool QApplication::notify(QObject *, QEvent *)\nThis method can be reimplemented in a derived class.", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("notify", "@hide", false, &_init_cbs_notify_2411_0, &_call_cbs_notify_2411_0, &_set_callback_cbs_notify_2411_0);
methods += new qt_gsi::GenericMethod ("emit_objectNameChanged", "@brief Emitter for signal void QApplication::objectNameChanged(const QString &objectName)\nCall this method to emit this signal.", false, &_init_emitter_objectNameChanged_4567, &_call_emitter_objectNameChanged_4567);
methods += new qt_gsi::GenericMethod ("emit_organizationDomainChanged", "@brief Emitter for signal void QApplication::organizationDomainChanged()\nCall this method to emit this signal.", false, &_init_emitter_organizationDomainChanged_0, &_call_emitter_organizationDomainChanged_0);
methods += new qt_gsi::GenericMethod ("emit_organizationNameChanged", "@brief Emitter for signal void QApplication::organizationNameChanged()\nCall this method to emit this signal.", false, &_init_emitter_organizationNameChanged_0, &_call_emitter_organizationNameChanged_0);

View File

@ -12,7 +12,8 @@ SUBDIRS = \
QtPrintSupport \
QtSvg \
QtXmlPatterns \
QtXml
QtXml \
QtUiTools
QtGui.depends += QtCore
QtNetwork.depends += QtCore
@ -24,3 +25,4 @@ QtPrintSupport.depends += QtCore QtWidgets
QtSvg.depends += QtCore QtWidgets
QtXmlPatterns.depends += QtCore
QtXml.depends += QtCore
QtUiTools.depends += QtCore

View File

@ -0,0 +1,27 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2021 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if QT_VERSION >= 0x050000
# include "../qt5/QtUiTools/gsiQtExternals.h"
#else
# include "../qt4/QtUiTools/gsiQtExternals.h"
#endif

View File

@ -163,13 +163,13 @@ equals(HAVE_QT, "0") {
QT += core network xml sql
equals(HAVE_QT5, "1") {
QT += designer printsupport widgets
QT += designer printsupport widgets uitools
equals(HAVE_QTBINDINGS, "1") {
QT += multimedia multimediawidgets xmlpatterns svg gui
}
} else {
# questionable: use uitools instead?
CONFIG += designer
CONFIG += designer uitools
}
}

View File

@ -51,18 +51,30 @@
// pulls in the Qt GSI binding modules
# include "gsiQtGuiExternals.h"
# include "gsiQtWidgetsExternals.h"
# include "gsiQtCoreExternals.h"
# include "gsiQtMultimediaExternals.h"
# include "gsiQtPrintSupportExternals.h"
# include "gsiQtXmlExternals.h"
# include "gsiQtXmlPatternsExternals.h"
# include "gsiQtSqlExternals.h"
# include "gsiQtSvgExternals.h"
# include "gsiQtNetworkExternals.h"
# include "gsiQtDesignerExternals.h"
# include "gsiQtUiToolsExternals.h"
FORCE_LINK_GSI_QTCORE
FORCE_LINK_GSI_QTGUI
FORCE_LINK_GSI_QTWIDGETS
FORCE_LINK_GSI_QTMULTIMEDIA
FORCE_LINK_GSI_QTPRINTSUPPORT
FORCE_LINK_GSI_QTXML
FORCE_LINK_GSI_QTXMLPATTERNS
FORCE_LINK_GSI_QTDESIGNER
FORCE_LINK_GSI_QTNETWORK
FORCE_LINK_GSI_QTSQL
FORCE_LINK_GSI_QTSVG
FORCE_LINK_GSI_QTUITOOLS
#else
# define QT_EXTERNAL_BASE(x)

View File

@ -25,7 +25,7 @@ INCLUDEPATH += $$QTBASIC_INC
DEPENDPATH += $$QTBASIC_INC
equals(HAVE_QTBINDINGS, "1") {
LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtXml -lklayout_QtNetwork -lklayout_QtSql -lklayout_QtDesigner
LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtXml -lklayout_QtNetwork -lklayout_QtSql -lklayout_QtDesigner -lklayout_QtUiTools
equals(HAVE_QT5, "1") {
LIBS += -lklayout_QtMultimedia -lklayout_QtPrintSupport -lklayout_QtSvg -lklayout_QtWidgets -lklayout_QtXmlPatterns
}

View File

@ -30,6 +30,7 @@
<li>QtSql: database support</li>
<li>QtNetwork: various network protocols and supporting classes</li>
<li>QtDesigner: dynamically load designer files (.ui)</li>
<li>QtUiTools: dynamically load designer files (.ui)</li>
<li>QtMultimedia (Qt5): multimedia support</li>
<li>QtPrintSupport (Qt5): print support</li>
<li>QtSvg (Qt5): SVG implementation</li>

View File

@ -244,6 +244,7 @@ MacroEditorDialog::MacroEditorDialog (lay::Dispatcher *pr, lym::MacroCollection
m_highlighters (this),
m_in_exec (false),
m_in_breakpoint (false),
m_ignore_exec_events (false),
mp_exec_controller (0),
mp_current_interpreter (0),
m_continue (false),
@ -2850,54 +2851,77 @@ MacroEditorDialog::start_exec (gsi::Interpreter *ec)
if (m_in_exec) {
tl_assert (ec != mp_exec_controller);
return;
} else if (m_ignore_exec_events) {
return;
}
m_file_to_widget.clear ();
m_include_expanders.clear ();
m_include_paths_to_ids.clear ();
m_include_file_id_cache.clear ();
// prevents recursion
m_ignore_exec_events = true;
m_last_process_events = tl::Clock::current ();
try {
m_in_exec = true;
mp_exec_controller = ec;
m_in_breakpoint = false;
m_continue = true;
m_trace_count = 0;
m_current_stack_depth = -1;
m_process_events_interval = 0.05;
m_file_to_widget.clear ();
m_include_expanders.clear ();
m_include_paths_to_ids.clear ();
m_include_file_id_cache.clear ();
for (std::map<lym::Macro *, MacroEditorPage *>::const_iterator f = m_tab_widgets.begin (); f != m_tab_widgets.end (); ++f) {
f->second->exec_model ()->set_current_line (-1);
f->second->exec_model ()->set_run_mode (true);
m_last_process_events = tl::Clock::current ();
m_in_exec = true;
mp_exec_controller = ec;
m_in_breakpoint = false;
m_continue = true;
m_trace_count = 0;
m_current_stack_depth = -1;
m_process_events_interval = 0.05;
for (std::map<lym::Macro *, MacroEditorPage *>::const_iterator f = m_tab_widgets.begin (); f != m_tab_widgets.end (); ++f) {
f->second->exec_model ()->set_current_line (-1);
f->second->exec_model ()->set_run_mode (true);
}
do_update_ui_to_run_mode ();
} catch (...) {
// .. ignore exceptions here ..
}
do_update_ui_to_run_mode ();
m_ignore_exec_events = false;
}
void
MacroEditorDialog::end_exec (gsi::Interpreter *ec)
{
// ignore calls from other interpreters
if (m_in_exec && ec != mp_exec_controller) {
if ((m_in_exec && ec != mp_exec_controller) || m_ignore_exec_events) {
return;
}
if (QApplication::activeModalWidget () == this) {
// close this window if it was shown in modal mode
QDialog::accept ();
// prevents recursion
m_ignore_exec_events = true;
try {
m_in_exec = false;
mp_exec_controller = 0;
m_continue = false;
m_current_stack_depth = -1;
if (QApplication::activeModalWidget () == this) {
// close this window if it was shown in modal mode
QDialog::accept ();
}
for (std::map<lym::Macro *, MacroEditorPage *>::const_iterator f = m_tab_widgets.begin (); f != m_tab_widgets.end (); ++f) {
f->second->exec_model ()->set_run_mode (false);
}
do_update_ui_to_run_mode ();
} catch (...) {
// .. ignore exceptions here ..
}
m_in_exec = false;
mp_exec_controller = 0;
m_continue = false;
m_current_stack_depth = -1;
for (std::map<lym::Macro *, MacroEditorPage *>::const_iterator f = m_tab_widgets.begin (); f != m_tab_widgets.end (); ++f) {
f->second->exec_model ()->set_run_mode (false);
}
do_update_ui_to_run_mode ();
m_ignore_exec_events = false;
}
const size_t pseudo_file_offset = std::numeric_limits<size_t>::max () / 2;

View File

@ -323,7 +323,7 @@ private:
std::map<std::string, size_t> m_include_paths_to_ids;
std::map<std::pair<size_t, int>, std::pair<size_t, int> > m_include_file_id_cache;
std::vector<lay::MacroEditorTree *> m_macro_trees;
bool m_in_exec, m_in_breakpoint;
bool m_in_exec, m_in_breakpoint, m_ignore_exec_events;
gsi::Interpreter *mp_exec_controller, *mp_current_interpreter;
bool m_continue;
int m_trace_count;

View File

@ -25,6 +25,7 @@
#include "lymMacroInterpreter.h"
#include "tlExceptions.h"
#include "tlString.h"
#include "layQtTools.h"
#include <cstdio>
#include <iostream>
@ -584,12 +585,23 @@ void MacroEditorPage::current_line_changed ()
void MacroEditorPage::run_mode_changed ()
{
if (mp_exec_model->run_mode ()) {
set_error_line (0);
// this prevents recursion when the following lines trigger anything that routes through the interpreter
bool bl = mp_exec_model->blockSignals (true);
try {
if (mp_exec_model->run_mode ()) {
set_error_line (0);
}
mp_text->setReadOnly (! mp_macro || mp_macro->is_readonly () || mp_exec_model->run_mode ());
update_extra_selections ();
} catch (...) {
// .. ignore exceptions here ..
}
mp_text->setReadOnly (! mp_macro || mp_macro->is_readonly () || mp_exec_model->run_mode ());
update_extra_selections ();
mp_exec_model->blockSignals (bl);
}
void MacroEditorPage::breakpoints_changed ()

View File

@ -37,3 +37,4 @@ FORCE_LINK_GSI_QTGUI
FORCE_LINK_GSI_QTWIDGETS
DEFINE_PYMOD(QtCore, "QtCore", "KLayout/Qt module 'QtCore'")

View File

@ -0,0 +1,11 @@
TARGET = QtUiTools
include($$PWD/../pymod.pri)
SOURCES = \
QtUiToolsMain.cc \
HEADERS += \
LIBS += -lklayout_QtUiTools -lklayout_QtCore

View File

@ -0,0 +1,33 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2021 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../pymodHelper.h"
// To force linking of the QtCore module
#include "../../gsiqt/qtbasic/gsiQtCoreExternals.h"
FORCE_LINK_GSI_QTCORE
#include "../../gsiqt/qtbasic/gsiQtUiToolsExternals.h"
FORCE_LINK_GSI_QTUITOOLS
DEFINE_PYMOD(QtUiTools, "QtUiTools", "KLayout/Qt module 'QtUiTools'")

View File

@ -1,5 +1,5 @@
# klayout library definition file
__all__ = [ "tl", "db", "lib", "rdb", "QtCore", "QtGui", "QtXml", "QtSql", "QtNetwork", "QtDesigner", "lay" ]
__all__ = [ "tl", "db", "lib", "rdb", "QtCore", "QtGui", "QtXml", "QtSql", "QtNetwork", "QtDesigner", "QtUiTools", "lay" ]

View File

@ -2,7 +2,7 @@
# klayout library definition file
__all__ = [ "tl", "db", "lib", "rdb",
"QtCore", "QtGui", "QtNetwork", "QtSql", "QtWidgets", "QtDesigner",
"QtCore", "QtGui", "QtNetwork", "QtSql", "QtWidgets", "QtDesigner", "QtUiTools",
"QtMultimedia", "QtPrintSupport", "QtSvg", "QtXmlPatterns", "QtXml",
"lay" ]

View File

@ -20,6 +20,7 @@ SUBDIRS = \
QtSql \
QtWidgets \
QtDesigner \
QtUiTools \
QtMultimedia \
QtPrintSupport \
QtSvg \
@ -34,7 +35,8 @@ SUBDIRS = \
QtXml \
QtSql \
QtNetwork \
QtDesigner
QtDesigner \
QtUiTools
}
}

View File

@ -98,6 +98,7 @@ PYMODTEST (import_QtXml, "import_QtXml.py")
PYMODTEST (import_QtSql, "import_QtSql.py")
PYMODTEST (import_QtNetwork, "import_QtNetwork.py")
PYMODTEST (import_QtDesigner, "import_QtDesigner.py")
PYMODTEST (import_QtUiTools, "import_QtUiTools.py")
#if QT_VERSION >= 0x50000

View File

@ -31,6 +31,8 @@
#elif defined(__MACH__)
# include <mach/clock.h>
# include <mach/mach.h>
# include <sys/times.h>
# include <unistd.h>
#else
# include <sys/times.h>
# include <unistd.h>

43
testdata/pymod/import_QtUiTools.py vendored Executable file
View File

@ -0,0 +1,43 @@
# KLayout Layout Viewer
# Copyright (C) 2006-2021 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import klayout.QtCore as QtCore
import klayout.QtUiTools as QtUiTools
import unittest
import sys
# Tests the basic abilities of the module
class BasicTest(unittest.TestCase):
def test_1(self):
self.assertEqual("QUiLoader" in QtUiTools.__all__, True)
def test_2(self):
app = QtCore.QCoreApplication([ "appname" ])
q = QtUiTools.QUiLoader()
# run unit tests
if __name__ == '__main__':
suite = unittest.TestSuite()
suite = unittest.TestLoader().loadTestsFromTestCase(BasicTest)
if not unittest.TextTestRunner(verbosity = 1).run(suite).wasSuccessful():
sys.exit(1)