mirror of https://github.com/KLayout/klayout.git
WIP: Fixed build dependencies and code dependencies for Python modules (Qt5)
This commit is contained in:
parent
f093b305bf
commit
655e59d11a
|
|
@ -131,7 +131,8 @@ SOURCES = \
|
||||||
gsiDeclDbGlyphs.cc \
|
gsiDeclDbGlyphs.cc \
|
||||||
dbVariableWidthPath.cc \
|
dbVariableWidthPath.cc \
|
||||||
dbNamedLayerReader.cc \
|
dbNamedLayerReader.cc \
|
||||||
dbEdgesToContours.cc
|
dbEdgesToContours.cc \
|
||||||
|
dbForceLink.cc
|
||||||
|
|
||||||
HEADERS = \
|
HEADERS = \
|
||||||
dbArray.h \
|
dbArray.h \
|
||||||
|
|
@ -233,7 +234,8 @@ HEADERS = \
|
||||||
dbGlyphs.h \
|
dbGlyphs.h \
|
||||||
dbCommon.h \
|
dbCommon.h \
|
||||||
dbVariableWidthPath.h \
|
dbVariableWidthPath.h \
|
||||||
dbNamedLayerReader.h
|
dbNamedLayerReader.h \
|
||||||
|
dbForceLink.h
|
||||||
|
|
||||||
RESOURCES = \
|
RESOURCES = \
|
||||||
dbResources.qrc
|
dbResources.qrc
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2018 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 "dbForceLink.h"
|
||||||
|
|
||||||
|
namespace db
|
||||||
|
{
|
||||||
|
int _force_link_f ()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2018 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
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_dbForceLink
|
||||||
|
#define HDR_dbForceLink
|
||||||
|
|
||||||
|
#include "dbCommon.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file Include this function to force linking of the db module
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace db
|
||||||
|
{
|
||||||
|
DB_PUBLIC int _force_link_f ();
|
||||||
|
static int _force_link_target = _force_link_f ();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ DEFINES += MAKE_GSI_QTCORE_LIBRARY
|
||||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$QTBASIC_INC
|
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$QTBASIC_INC
|
||||||
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$QTBASIC_INC
|
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic -lklayout_QtGui
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
gsiDeclQtCoreAdd.cc
|
gsiDeclQtCoreAdd.cc
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,6 @@
|
||||||
// namespace which is in QtCore ... this introduces a dependency of QtCore GSI lib on QtGui.
|
// namespace which is in QtCore ... this introduces a dependency of QtCore GSI lib on QtGui.
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
// 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 "gsiQtGuiExternals.h"
|
|
||||||
FORCE_LINK_GSI_QTGUI
|
|
||||||
|
|
||||||
class Qt_Namespace { };
|
class Qt_Namespace { };
|
||||||
|
|
||||||
namespace gsi_qt
|
namespace gsi_qt
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
|
|
||||||
#include "gsiQt.h"
|
#include "gsiQt.h"
|
||||||
|
// required to pull in the GSI declarations from db:
|
||||||
|
#include "dbForceLink.h"
|
||||||
|
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QAccessibleInterface>
|
#include <QAccessibleInterface>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "gsiQt.h"
|
#include "gsiQt.h"
|
||||||
|
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
|
@ -174,23 +173,6 @@ gsi::Class<QPair<double, QVariant> > decl_double_QVariant_QPair ("QtCore", "QPai
|
||||||
"@qt\\n@brief Represents a QPair<double, QVariant>"
|
"@qt\\n@brief Represents a QPair<double, QVariant>"
|
||||||
);
|
);
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Add declaration for HitTestAccuracy which would be in QtGui, but is in Qt namespace
|
|
||||||
// (hence QtCore)
|
|
||||||
|
|
||||||
static gsi::Enum<Qt::HitTestAccuracy> decl_Qt_HitTestAccuracy_Enum ("QtCore", "Qt_HitTestAccuracy",
|
|
||||||
gsi::enum_const ("ExactHit", Qt::ExactHit, "@brief Enum constant Qt::ExactHit") +
|
|
||||||
gsi::enum_const ("FuzzyHit", Qt::FuzzyHit, "@brief Enum constant Qt::FuzzyHit"),
|
|
||||||
"@qt\n@brief This class represents the Qt::HitTestAccuracy enum");
|
|
||||||
|
|
||||||
static gsi::QFlagsClass<Qt::HitTestAccuracy > decl_Qt_HitTestAccuracy_Enums ("QtCore", "Qt_QFlags_HitTestAccuracy",
|
|
||||||
"@qt\n@brief This class represents the QFlags<Qt::HitTestAccuracy> flag set");
|
|
||||||
|
|
||||||
// Inject the declarations into the parent
|
|
||||||
static gsi::ClassExt<Qt_Namespace> inject_Qt_HitTestAccuracy_Enum_in_parent (decl_Qt_HitTestAccuracy_Enum.defs ());
|
|
||||||
static gsi::ClassExt<Qt_Namespace> decl_Qt_HitTestAccuracy_Enum_as_child (decl_Qt_HitTestAccuracy_Enum, "HitTestAccuracy");
|
|
||||||
static gsi::ClassExt<Qt_Namespace> decl_Qt_HitTestAccuracy_Enums_as_child (decl_Qt_HitTestAccuracy_Enums, "QFlags_HitTestAccuracy");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// QtMsgType implementation
|
// QtMsgType implementation
|
||||||
// (this type is not created automatically since QtMsgType is not within a namespace)
|
// (this type is not created automatically since QtMsgType is not within a namespace)
|
||||||
|
|
@ -205,4 +187,277 @@ static gsi::Enum<QtMsgType> decl_QtMsgType ("QtCore", "QtMsgType",
|
||||||
gsi::enum_const ("QtSystemMsg", QtSystemMsg, "@brief Enum constant QtSystemMsg of QtMsgType")
|
gsi::enum_const ("QtSystemMsg", QtSystemMsg, "@brief Enum constant QtSystemMsg of QtMsgType")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// QUrlTwoFlags<QUrl::UrlFormattingOption, QUrl::ComponentFormattingOption> bindings
|
||||||
|
|
||||||
|
template <class A, class B>
|
||||||
|
class QUrlTwoFlagsClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief An adaptor class for the QUrlTwoFlags<A, B> template derived from QFlagsAdaptor<E> template
|
||||||
|
*/
|
||||||
|
template <class A, class B>
|
||||||
|
class QUrlTwoFlagsAdaptor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QUrlTwoFlagsAdaptor () : m_qf () { }
|
||||||
|
QUrlTwoFlagsAdaptor (A e) : m_qf (e) { }
|
||||||
|
QUrlTwoFlagsAdaptor (B e) : m_qf (e) { }
|
||||||
|
QUrlTwoFlagsAdaptor (QFlags<A> e) : m_qf (e) { }
|
||||||
|
QUrlTwoFlagsAdaptor (QFlags<B> e) : m_qf (e) { }
|
||||||
|
QUrlTwoFlagsAdaptor (const QUrlTwoFlags<A, B> &qf) : m_qf (qf) { }
|
||||||
|
QUrlTwoFlagsAdaptor (int i) : m_qf (i) { }
|
||||||
|
|
||||||
|
QUrlTwoFlagsAdaptor (const std::string &s)
|
||||||
|
{
|
||||||
|
const QUrlTwoFlagsClass<A, B> *ecls = dynamic_cast<const QUrlTwoFlagsClass<A, B> *> (gsi::cls_decl<QUrlTwoFlags<A, B> > ());
|
||||||
|
tl_assert (ecls != 0);
|
||||||
|
m_qf = ecls->qflags_from_string (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrlTwoFlags<A, B> &value () { return m_qf; }
|
||||||
|
const QUrlTwoFlags<A, B> &value () const { return m_qf; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QUrlTwoFlags<A, B> m_qf;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A binding for QUrlTwoFlags<A, B> derived from QFlags binding
|
||||||
|
*/
|
||||||
|
template <class A, class B>
|
||||||
|
class QUrlTwoFlagsClass
|
||||||
|
: public gsi::Class<QUrlTwoFlagsAdaptor<A, B>, QUrlTwoFlags<A, B> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename QFlags<A>::Int int_repr;
|
||||||
|
|
||||||
|
QUrlTwoFlagsClass (const std::string &module, const std::string &name, const std::string &doc = std::string ())
|
||||||
|
: gsi::Class<QUrlTwoFlagsAdaptor<A, B>, QUrlTwoFlags<A, B> > (module, name, methods (), doc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> *new_from_i (int_repr i)
|
||||||
|
{
|
||||||
|
return new QUrlTwoFlags<A, B> (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> *new_from_e1 (A e)
|
||||||
|
{
|
||||||
|
return new QUrlTwoFlags<A, B> (e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> *new_from_e1f (QFlags<A> e)
|
||||||
|
{
|
||||||
|
return new QUrlTwoFlags<A, B> (e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> *new_from_e2 (B e)
|
||||||
|
{
|
||||||
|
return new QUrlTwoFlags<A, B> (e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> *new_from_e2f (QFlags<B> e)
|
||||||
|
{
|
||||||
|
return new QUrlTwoFlags<A, B> (e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> *new_from_s (const std::string &s)
|
||||||
|
{
|
||||||
|
QUrlTwoFlags<A, B> flags;
|
||||||
|
|
||||||
|
const gsi::Enum<A> *acls = dynamic_cast<const gsi::Enum<A> *> (gsi::cls_decl<A> ());
|
||||||
|
const gsi::Enum<B> *bcls = dynamic_cast<const gsi::Enum<B> *> (gsi::cls_decl<B> ());
|
||||||
|
tl_assert (acls != 0 && bcls != 0);
|
||||||
|
|
||||||
|
tl::Extractor ex (s.c_str ());
|
||||||
|
while (! ex.at_end ()) {
|
||||||
|
|
||||||
|
bool any = false;
|
||||||
|
|
||||||
|
for (typename gsi::EnumSpecs<A>::iterator s = acls->specs ().begin (); s != acls->specs ().end () && !any; ++s) {
|
||||||
|
if (ex.test (s->str.c_str ())) {
|
||||||
|
flags |= A (s->evalue);
|
||||||
|
any = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (typename gsi::EnumSpecs<B>::iterator s = bcls->specs ().begin (); s != bcls->specs ().end () && !any; ++s) {
|
||||||
|
if (ex.test (s->str.c_str ())) {
|
||||||
|
flags |= B (s->evalue);
|
||||||
|
any = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (any) {
|
||||||
|
ex.test ("|");
|
||||||
|
ex.test (",");
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return new QUrlTwoFlags<A, B> (flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string to_s (const QUrlTwoFlags<A, B> *self)
|
||||||
|
{
|
||||||
|
std::string res;
|
||||||
|
|
||||||
|
const gsi::Enum<A> *acls = dynamic_cast<const gsi::Enum<A> *> (gsi::cls_decl<A> ());
|
||||||
|
const gsi::Enum<B> *bcls = dynamic_cast<const gsi::Enum<B> *> (gsi::cls_decl<B> ());
|
||||||
|
tl_assert (acls != 0 && bcls != 0);
|
||||||
|
|
||||||
|
for (typename gsi::EnumSpecs<A>::iterator s = acls->specs ().begin (); s != acls->specs ().end (); ++s) {
|
||||||
|
if (self->testFlag (s->evalue)) {
|
||||||
|
if (! res.empty ()) {
|
||||||
|
res += "|";
|
||||||
|
}
|
||||||
|
res += s->str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (typename gsi::EnumSpecs<B>::iterator s = bcls->specs ().begin (); s != bcls->specs ().end (); ++s) {
|
||||||
|
if (self->testFlag (s->evalue)) {
|
||||||
|
if (! res.empty ()) {
|
||||||
|
res += "|";
|
||||||
|
}
|
||||||
|
res += s->str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int_repr to_i (const QUrlTwoFlags<A, B> *self)
|
||||||
|
{
|
||||||
|
return int_repr (*self);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool test_flag1 (const QUrlTwoFlags<A, B> *self, A e)
|
||||||
|
{
|
||||||
|
return self->testFlag (e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool test_flag2 (const QUrlTwoFlags<A, B> *self, B e)
|
||||||
|
{
|
||||||
|
return self->testFlag (e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string inspect (const QUrlTwoFlags<A, B> *self)
|
||||||
|
{
|
||||||
|
return to_s (self) + tl::sprintf(" (%u)", (unsigned int) (int_repr (*self)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> invert (const QUrlTwoFlags<A, B> *self)
|
||||||
|
{
|
||||||
|
return ~*self;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> or_op (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
||||||
|
{
|
||||||
|
return *self | other;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> or_op_with_e1 (const QUrlTwoFlags<A, B> *self, A e)
|
||||||
|
{
|
||||||
|
return *self | e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> or_op_with_e2 (const QUrlTwoFlags<A, B> *self, B e)
|
||||||
|
{
|
||||||
|
return *self | e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> and_op (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
||||||
|
{
|
||||||
|
return *self & other;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> and_op_with_e1 (const QUrlTwoFlags<A, B> *self, A e)
|
||||||
|
{
|
||||||
|
return *self & e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> and_op_with_e2 (const QUrlTwoFlags<A, B> *self, B e)
|
||||||
|
{
|
||||||
|
return *self & e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> xor_op (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
||||||
|
{
|
||||||
|
return *self ^ other;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> xor_op_with_e1 (const QUrlTwoFlags<A, B> *self, A e)
|
||||||
|
{
|
||||||
|
return *self ^ e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QUrlTwoFlags<A, B> xor_op_with_e2 (const QUrlTwoFlags<A, B> *self, B e)
|
||||||
|
{
|
||||||
|
return *self ^ e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool not_equal_with_i (const QUrlTwoFlags<A, B> *self, int_repr i)
|
||||||
|
{
|
||||||
|
return int_repr (*self) != i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool not_equal (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
||||||
|
{
|
||||||
|
// See equal() for an explanation why we compare int's.
|
||||||
|
return int_repr (*self) != int_repr (other);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool equal_with_i (const QUrlTwoFlags<A, B> *self, int_repr i)
|
||||||
|
{
|
||||||
|
return int_repr (*self) == i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool equal (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
||||||
|
{
|
||||||
|
// NOTE: in order to avoid ambiguities with non-explicit constructors of objects taking a QFlag as an argument,
|
||||||
|
// we compare int's explicitly. An example for such an ambiguity is QSurfaceFormat in Qt 5.5.1 which takes a QFlags<FormatOption>
|
||||||
|
// object in a non-explicit constructor.
|
||||||
|
return int_repr (*self) == int_repr (other);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gsi::Methods methods ()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
gsi::constructor ("new", &new_from_i, gsi::arg ("i"), "@brief Creates a flag set from an integer value") +
|
||||||
|
gsi::constructor ("new", &new_from_s, gsi::arg ("s"), "@brief Creates a flag set from a string") +
|
||||||
|
gsi::constructor ("new", &new_from_e1, gsi::arg ("e"), "@brief Creates a flag set from an enum") +
|
||||||
|
gsi::constructor ("new", &new_from_e1f, gsi::arg ("e"), "@brief Creates a flag set from a QFlags set") +
|
||||||
|
gsi::constructor ("new", &new_from_e2, gsi::arg ("e"), "@brief Creates a flag set from an enum") +
|
||||||
|
gsi::constructor ("new", &new_from_e2f, gsi::arg ("e"), "@brief Creates a flag set from a QFlags set") +
|
||||||
|
gsi::method_ext ("to_s", &to_s, "@brief Converts the flag set to a string") +
|
||||||
|
gsi::method_ext ("to_i", &to_i, "@brief Converts the flag set to an integer") +
|
||||||
|
gsi::method_ext ("testFlag1", &test_flag1, gsi::arg ("flag"), "@brief Tests whether the flag set contains the given flag") +
|
||||||
|
gsi::method_ext ("testFlag2", &test_flag2, gsi::arg ("flag"), "@brief Tests whether the flag set contains the given flag") +
|
||||||
|
gsi::method_ext ("inspect", &inspect, "@brief Converts the flag set to a visual string") +
|
||||||
|
gsi::method_ext ("|", &or_op, gsi::arg ("other"), "@brief Computes the union of two flag sets") +
|
||||||
|
gsi::method_ext ("|", &or_op_with_e1, gsi::arg ("flag"), "@brief Adds the given flag to the flag set and returns the new flag set") +
|
||||||
|
gsi::method_ext ("|", &or_op_with_e2, gsi::arg ("flag"), "@brief Adds the given flag to the flag set and returns the new flag set") +
|
||||||
|
gsi::method_ext ("&", &and_op, gsi::arg ("other"), "@brief Computes the intersection between the two flag sets") +
|
||||||
|
gsi::method_ext ("&", &and_op_with_e1, gsi::arg ("flag"), "@brief Tests whether the given flag is contained in the flag set and returns a null flag set if not") +
|
||||||
|
gsi::method_ext ("&", &and_op_with_e2, gsi::arg ("flag"), "@brief Tests whether the given flag is contained in the flag set and returns a null flag set if not") +
|
||||||
|
gsi::method_ext ("^", &xor_op, gsi::arg ("other"), "@brief Computes the exclusive-or between the flag set and the other flag set") +
|
||||||
|
gsi::method_ext ("^", &xor_op_with_e1, gsi::arg ("flag"), "@brief Inverts the given flag in the flag set and returns the new flag set") +
|
||||||
|
gsi::method_ext ("^", &xor_op_with_e2, gsi::arg ("flag"), "@brief Inverts the given flag in the flag set and returns the new flag set") +
|
||||||
|
gsi::method_ext ("==", &equal_with_i, gsi::arg ("other"), "@brief Returns true if the flag set equals the given integer value") +
|
||||||
|
gsi::method_ext ("==", &equal, gsi::arg ("i"), "@brief Returns true if the flag set equals the given other flag set") +
|
||||||
|
gsi::method_ext ("!=", ¬_equal_with_i, gsi::arg ("other"), "@brief Returns true if the flag set is not equal to the given integer value") +
|
||||||
|
gsi::method_ext ("!=", ¬_equal, gsi::arg ("i"), "@brief Returns true if the flag set is not equal to the given other flag set") +
|
||||||
|
gsi::method_ext ("~", &invert, "@brief Returns the inverted flag set");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static QUrlTwoFlagsClass<QUrl::UrlFormattingOption, QUrl::ComponentFormattingOption> decl_QUrlTwoFlags ("QtCore", "QUrl_FormattingOptions", "@brief Binding of QUrl::FormattingOptions");
|
||||||
|
|
||||||
|
// inject as QUrl::FormattingOptions
|
||||||
|
static gsi::ClassExt<QUrl> decl_QUrlTwoFlags_as_child (decl_QUrlTwoFlags, "FormattingOptions", "@brief Binding of QUrl::FormattingOptions");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ INCLUDEPATH += $$DB_INC
|
||||||
DEPENDPATH += $$DB_INC
|
DEPENDPATH += $$DB_INC
|
||||||
LIBS += -lklayout_db
|
LIBS += -lklayout_db
|
||||||
|
|
||||||
|
# because QQbject is used as base class for many classes, we need this:
|
||||||
|
LIBS += -lklayout_QtCore
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
gsiDeclQtGuiAdd.cc
|
gsiDeclQtGuiAdd.cc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "gsiQt.h"
|
#include "gsiQt.h"
|
||||||
|
// required to pull in the GSI declarations from db:
|
||||||
|
#include "dbForceLink.h"
|
||||||
|
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QAccessibleInterface>
|
#include <QAccessibleInterface>
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
|
# because QQbject is used as base class for many classes, we need this:
|
||||||
|
LIBS += -lklayout_QtCore
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
gsiDeclQtNetworkAdd.cc
|
gsiDeclQtNetworkAdd.cc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,277 +38,4 @@ gsi::Class<QPair<QHostAddress, int> > decl_QHostAddress_int_QPair ("QtNetwork",
|
||||||
"@qt\\n@brief Represents a QPair<QHostAddress, int>"
|
"@qt\\n@brief Represents a QPair<QHostAddress, int>"
|
||||||
);
|
);
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// QUrlTwoFlags<QUrl::UrlFormattingOption, QUrl::ComponentFormattingOption> bindings
|
|
||||||
|
|
||||||
template <class A, class B>
|
|
||||||
class QUrlTwoFlagsClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief An adaptor class for the QUrlTwoFlags<A, B> template derived from QFlagsAdaptor<E> template
|
|
||||||
*/
|
|
||||||
template <class A, class B>
|
|
||||||
class QUrlTwoFlagsAdaptor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QUrlTwoFlagsAdaptor () : m_qf () { }
|
|
||||||
QUrlTwoFlagsAdaptor (A e) : m_qf (e) { }
|
|
||||||
QUrlTwoFlagsAdaptor (B e) : m_qf (e) { }
|
|
||||||
QUrlTwoFlagsAdaptor (QFlags<A> e) : m_qf (e) { }
|
|
||||||
QUrlTwoFlagsAdaptor (QFlags<B> e) : m_qf (e) { }
|
|
||||||
QUrlTwoFlagsAdaptor (const QUrlTwoFlags<A, B> &qf) : m_qf (qf) { }
|
|
||||||
QUrlTwoFlagsAdaptor (int i) : m_qf (i) { }
|
|
||||||
|
|
||||||
QUrlTwoFlagsAdaptor (const std::string &s)
|
|
||||||
{
|
|
||||||
const QUrlTwoFlagsClass<A, B> *ecls = dynamic_cast<const QUrlTwoFlagsClass<A, B> *> (gsi::cls_decl<QUrlTwoFlags<A, B> > ());
|
|
||||||
tl_assert (ecls != 0);
|
|
||||||
m_qf = ecls->qflags_from_string (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
QUrlTwoFlags<A, B> &value () { return m_qf; }
|
|
||||||
const QUrlTwoFlags<A, B> &value () const { return m_qf; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
QUrlTwoFlags<A, B> m_qf;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A binding for QUrlTwoFlags<A, B> derived from QFlags binding
|
|
||||||
*/
|
|
||||||
template <class A, class B>
|
|
||||||
class QUrlTwoFlagsClass
|
|
||||||
: public gsi::Class<QUrlTwoFlagsAdaptor<A, B>, QUrlTwoFlags<A, B> >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef typename QFlags<A>::Int int_repr;
|
|
||||||
|
|
||||||
QUrlTwoFlagsClass (const std::string &module, const std::string &name, const std::string &doc = std::string ())
|
|
||||||
: gsi::Class<QUrlTwoFlagsAdaptor<A, B>, QUrlTwoFlags<A, B> > (module, name, methods (), doc)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> *new_from_i (int_repr i)
|
|
||||||
{
|
|
||||||
return new QUrlTwoFlags<A, B> (i);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> *new_from_e1 (A e)
|
|
||||||
{
|
|
||||||
return new QUrlTwoFlags<A, B> (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> *new_from_e1f (QFlags<A> e)
|
|
||||||
{
|
|
||||||
return new QUrlTwoFlags<A, B> (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> *new_from_e2 (B e)
|
|
||||||
{
|
|
||||||
return new QUrlTwoFlags<A, B> (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> *new_from_e2f (QFlags<B> e)
|
|
||||||
{
|
|
||||||
return new QUrlTwoFlags<A, B> (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> *new_from_s (const std::string &s)
|
|
||||||
{
|
|
||||||
QUrlTwoFlags<A, B> flags;
|
|
||||||
|
|
||||||
const gsi::Enum<A> *acls = dynamic_cast<const gsi::Enum<A> *> (gsi::cls_decl<A> ());
|
|
||||||
const gsi::Enum<B> *bcls = dynamic_cast<const gsi::Enum<B> *> (gsi::cls_decl<B> ());
|
|
||||||
tl_assert (acls != 0 && bcls != 0);
|
|
||||||
|
|
||||||
tl::Extractor ex (s.c_str ());
|
|
||||||
while (! ex.at_end ()) {
|
|
||||||
|
|
||||||
bool any = false;
|
|
||||||
|
|
||||||
for (typename gsi::EnumSpecs<A>::iterator s = acls->specs ().begin (); s != acls->specs ().end () && !any; ++s) {
|
|
||||||
if (ex.test (s->str.c_str ())) {
|
|
||||||
flags |= A (s->evalue);
|
|
||||||
any = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (typename gsi::EnumSpecs<B>::iterator s = bcls->specs ().begin (); s != bcls->specs ().end () && !any; ++s) {
|
|
||||||
if (ex.test (s->str.c_str ())) {
|
|
||||||
flags |= B (s->evalue);
|
|
||||||
any = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (any) {
|
|
||||||
ex.test ("|");
|
|
||||||
ex.test (",");
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return new QUrlTwoFlags<A, B> (flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string to_s (const QUrlTwoFlags<A, B> *self)
|
|
||||||
{
|
|
||||||
std::string res;
|
|
||||||
|
|
||||||
const gsi::Enum<A> *acls = dynamic_cast<const gsi::Enum<A> *> (gsi::cls_decl<A> ());
|
|
||||||
const gsi::Enum<B> *bcls = dynamic_cast<const gsi::Enum<B> *> (gsi::cls_decl<B> ());
|
|
||||||
tl_assert (acls != 0 && bcls != 0);
|
|
||||||
|
|
||||||
for (typename gsi::EnumSpecs<A>::iterator s = acls->specs ().begin (); s != acls->specs ().end (); ++s) {
|
|
||||||
if (self->testFlag (s->evalue)) {
|
|
||||||
if (! res.empty ()) {
|
|
||||||
res += "|";
|
|
||||||
}
|
|
||||||
res += s->str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (typename gsi::EnumSpecs<B>::iterator s = bcls->specs ().begin (); s != bcls->specs ().end (); ++s) {
|
|
||||||
if (self->testFlag (s->evalue)) {
|
|
||||||
if (! res.empty ()) {
|
|
||||||
res += "|";
|
|
||||||
}
|
|
||||||
res += s->str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int_repr to_i (const QUrlTwoFlags<A, B> *self)
|
|
||||||
{
|
|
||||||
return int_repr (*self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool test_flag1 (const QUrlTwoFlags<A, B> *self, A e)
|
|
||||||
{
|
|
||||||
return self->testFlag (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool test_flag2 (const QUrlTwoFlags<A, B> *self, B e)
|
|
||||||
{
|
|
||||||
return self->testFlag (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string inspect (const QUrlTwoFlags<A, B> *self)
|
|
||||||
{
|
|
||||||
return to_s (self) + tl::sprintf(" (%u)", (unsigned int) (int_repr (*self)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> invert (const QUrlTwoFlags<A, B> *self)
|
|
||||||
{
|
|
||||||
return ~*self;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> or_op (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
|
||||||
{
|
|
||||||
return *self | other;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> or_op_with_e1 (const QUrlTwoFlags<A, B> *self, A e)
|
|
||||||
{
|
|
||||||
return *self | e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> or_op_with_e2 (const QUrlTwoFlags<A, B> *self, B e)
|
|
||||||
{
|
|
||||||
return *self | e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> and_op (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
|
||||||
{
|
|
||||||
return *self & other;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> and_op_with_e1 (const QUrlTwoFlags<A, B> *self, A e)
|
|
||||||
{
|
|
||||||
return *self & e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> and_op_with_e2 (const QUrlTwoFlags<A, B> *self, B e)
|
|
||||||
{
|
|
||||||
return *self & e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> xor_op (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
|
||||||
{
|
|
||||||
return *self ^ other;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> xor_op_with_e1 (const QUrlTwoFlags<A, B> *self, A e)
|
|
||||||
{
|
|
||||||
return *self ^ e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QUrlTwoFlags<A, B> xor_op_with_e2 (const QUrlTwoFlags<A, B> *self, B e)
|
|
||||||
{
|
|
||||||
return *self ^ e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool not_equal_with_i (const QUrlTwoFlags<A, B> *self, int_repr i)
|
|
||||||
{
|
|
||||||
return int_repr (*self) != i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool not_equal (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
|
||||||
{
|
|
||||||
// See equal() for an explanation why we compare int's.
|
|
||||||
return int_repr (*self) != int_repr (other);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool equal_with_i (const QUrlTwoFlags<A, B> *self, int_repr i)
|
|
||||||
{
|
|
||||||
return int_repr (*self) == i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool equal (const QUrlTwoFlags<A, B> *self, const QUrlTwoFlags<A, B> &other)
|
|
||||||
{
|
|
||||||
// NOTE: in order to avoid ambiguities with non-explicit constructors of objects taking a QFlag as an argument,
|
|
||||||
// we compare int's explicitly. An example for such an ambiguity is QSurfaceFormat in Qt 5.5.1 which takes a QFlags<FormatOption>
|
|
||||||
// object in a non-explicit constructor.
|
|
||||||
return int_repr (*self) == int_repr (other);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gsi::Methods methods ()
|
|
||||||
{
|
|
||||||
return
|
|
||||||
gsi::constructor ("new", &new_from_i, gsi::arg ("i"), "@brief Creates a flag set from an integer value") +
|
|
||||||
gsi::constructor ("new", &new_from_s, gsi::arg ("s"), "@brief Creates a flag set from a string") +
|
|
||||||
gsi::constructor ("new", &new_from_e1, gsi::arg ("e"), "@brief Creates a flag set from an enum") +
|
|
||||||
gsi::constructor ("new", &new_from_e1f, gsi::arg ("e"), "@brief Creates a flag set from a QFlags set") +
|
|
||||||
gsi::constructor ("new", &new_from_e2, gsi::arg ("e"), "@brief Creates a flag set from an enum") +
|
|
||||||
gsi::constructor ("new", &new_from_e2f, gsi::arg ("e"), "@brief Creates a flag set from a QFlags set") +
|
|
||||||
gsi::method_ext ("to_s", &to_s, "@brief Converts the flag set to a string") +
|
|
||||||
gsi::method_ext ("to_i", &to_i, "@brief Converts the flag set to an integer") +
|
|
||||||
gsi::method_ext ("testFlag1", &test_flag1, gsi::arg ("flag"), "@brief Tests whether the flag set contains the given flag") +
|
|
||||||
gsi::method_ext ("testFlag2", &test_flag2, gsi::arg ("flag"), "@brief Tests whether the flag set contains the given flag") +
|
|
||||||
gsi::method_ext ("inspect", &inspect, "@brief Converts the flag set to a visual string") +
|
|
||||||
gsi::method_ext ("|", &or_op, gsi::arg ("other"), "@brief Computes the union of two flag sets") +
|
|
||||||
gsi::method_ext ("|", &or_op_with_e1, gsi::arg ("flag"), "@brief Adds the given flag to the flag set and returns the new flag set") +
|
|
||||||
gsi::method_ext ("|", &or_op_with_e2, gsi::arg ("flag"), "@brief Adds the given flag to the flag set and returns the new flag set") +
|
|
||||||
gsi::method_ext ("&", &and_op, gsi::arg ("other"), "@brief Computes the intersection between the two flag sets") +
|
|
||||||
gsi::method_ext ("&", &and_op_with_e1, gsi::arg ("flag"), "@brief Tests whether the given flag is contained in the flag set and returns a null flag set if not") +
|
|
||||||
gsi::method_ext ("&", &and_op_with_e2, gsi::arg ("flag"), "@brief Tests whether the given flag is contained in the flag set and returns a null flag set if not") +
|
|
||||||
gsi::method_ext ("^", &xor_op, gsi::arg ("other"), "@brief Computes the exclusive-or between the flag set and the other flag set") +
|
|
||||||
gsi::method_ext ("^", &xor_op_with_e1, gsi::arg ("flag"), "@brief Inverts the given flag in the flag set and returns the new flag set") +
|
|
||||||
gsi::method_ext ("^", &xor_op_with_e2, gsi::arg ("flag"), "@brief Inverts the given flag in the flag set and returns the new flag set") +
|
|
||||||
gsi::method_ext ("==", &equal_with_i, gsi::arg ("other"), "@brief Returns true if the flag set equals the given integer value") +
|
|
||||||
gsi::method_ext ("==", &equal, gsi::arg ("i"), "@brief Returns true if the flag set equals the given other flag set") +
|
|
||||||
gsi::method_ext ("!=", ¬_equal_with_i, gsi::arg ("other"), "@brief Returns true if the flag set is not equal to the given integer value") +
|
|
||||||
gsi::method_ext ("!=", ¬_equal, gsi::arg ("i"), "@brief Returns true if the flag set is not equal to the given other flag set") +
|
|
||||||
gsi::method_ext ("~", &invert, "@brief Returns the inverted flag set");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static QUrlTwoFlagsClass<QUrl::UrlFormattingOption, QUrl::ComponentFormattingOption> decl_QUrlTwoFlags ("QtNetwork", "QUrl_FormattingOptions", "@brief Binding of QUrl::FormattingOptions");
|
|
||||||
|
|
||||||
// inject as QUrl::FormattingOptions
|
|
||||||
static gsi::ClassExt<QUrl> decl_QUrlTwoFlags_as_child (decl_QUrlTwoFlags, "FormattingOptions", "@brief Binding of QUrl::FormattingOptions");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@ DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
|
# because QQbject is used as base class for many classes, we need this:
|
||||||
|
LIBS += -lklayout_QtCore
|
||||||
|
|
||||||
|
# because QWidget is used for some UI stuff, we need this:
|
||||||
|
LIBS += -lklayout_QtWidgets
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
|
# because QQbject is used as base class for many classes, we need this:
|
||||||
|
LIBS += -lklayout_QtCore
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@ DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
|
# because QQbject is used as base class for many classes, we need this:
|
||||||
|
LIBS += -lklayout_QtCore
|
||||||
|
|
||||||
|
# because QWidget is used for some UI stuff, we need this:
|
||||||
|
LIBS += -lklayout_QtWidgets
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@ DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
|
# because QPainter is used as base class for QStylePainter, we need this:
|
||||||
|
LIBS += -lklayout_QtGui
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
gsiDeclQtWidgetsAdd.cc
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
||||||
include(QtWidgets.pri)
|
include(QtWidgets.pri)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2018 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 "gsiQt.h"
|
||||||
|
|
||||||
|
// .. nothing yet ..
|
||||||
|
|
@ -12,6 +12,9 @@ DEPENDPATH += $$TL_INC $$GSI_INC $$QTBASIC_INC
|
||||||
|
|
||||||
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_qtbasic
|
||||||
|
|
||||||
|
# because QQbject is used as base class for many classes, we need this:
|
||||||
|
LIBS += -lklayout_QtCore
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,13 @@ SUBDIRS = \
|
||||||
QtXmlPatterns \
|
QtXmlPatterns \
|
||||||
QtXml
|
QtXml
|
||||||
|
|
||||||
|
QtGui.depends += QtCore
|
||||||
|
QtNetwork.depends += QtCore
|
||||||
|
QtSql.depends += QtCore
|
||||||
|
QtWidgets.depends += QtGui
|
||||||
|
QtDesigner.depends += QtCore
|
||||||
|
QtMultimedia.depends += QtCore
|
||||||
|
QtPrintSupports.depends += QtCore QtWidgets
|
||||||
|
QtSvg.depends += QtCore QtWidgets
|
||||||
|
QtXmlPatterns.depends += QtCore
|
||||||
|
QtXml.depends += QtCore
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,8 @@ HEADERS = \
|
||||||
layNativePlugin.h \
|
layNativePlugin.h \
|
||||||
laySystemPaths.h \
|
laySystemPaths.h \
|
||||||
layMacroEditorSetupPage.h \
|
layMacroEditorSetupPage.h \
|
||||||
layPasswordDialog.h
|
layPasswordDialog.h \
|
||||||
|
layForceLink.h
|
||||||
|
|
||||||
FORMS = \
|
FORMS = \
|
||||||
ClipDialog.ui \
|
ClipDialog.ui \
|
||||||
|
|
@ -163,7 +164,8 @@ SOURCES = \
|
||||||
layNativePlugin.cc \
|
layNativePlugin.cc \
|
||||||
laySystemPaths.cc \
|
laySystemPaths.cc \
|
||||||
layMacroEditorSetupPage.cc \
|
layMacroEditorSetupPage.cc \
|
||||||
layPasswordDialog.cc
|
layPasswordDialog.cc \
|
||||||
|
layForceLink.cc
|
||||||
|
|
||||||
RESOURCES = layBuildInMacros.qrc \
|
RESOURCES = layBuildInMacros.qrc \
|
||||||
layHelpResources.qrc \
|
layHelpResources.qrc \
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2018 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 "layForceLink.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
int _force_link_f ()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2018 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
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layForceLink
|
||||||
|
#define HDR_layForceLink
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file Include this function to force linking of the lay module
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
LAY_PUBLIC int _force_link_f ();
|
||||||
|
static int _force_link_target = _force_link_f ();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@ -282,5 +282,8 @@ DEPENDPATH += $$QTBASIC_INC
|
||||||
|
|
||||||
equals(HAVE_QTBINDINGS, "1") {
|
equals(HAVE_QTBINDINGS, "1") {
|
||||||
LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtCore
|
LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtCore
|
||||||
|
equals(HAVE_QT5, "1") {
|
||||||
|
LIBS += -lklayout_QtWidgets
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2214,6 +2214,8 @@ std::map<const gsi::MethodBase *, std::string> PythonModule::m_python_doc;
|
||||||
std::map <PyTypeObject *, const gsi::ClassBase *> PythonModule::m_cls_map;
|
std::map <PyTypeObject *, const gsi::ClassBase *> PythonModule::m_cls_map;
|
||||||
std::map <const gsi::ClassBase *, PyTypeObject *> PythonModule::m_rev_cls_map;
|
std::map <const gsi::ClassBase *, PyTypeObject *> PythonModule::m_rev_cls_map;
|
||||||
|
|
||||||
|
const std::string pymod_name ("pykl");
|
||||||
|
|
||||||
PythonModule::PythonModule ()
|
PythonModule::PythonModule ()
|
||||||
: mp_mod_def (0)
|
: mp_mod_def (0)
|
||||||
{
|
{
|
||||||
|
|
@ -2229,27 +2231,6 @@ PythonModule::~PythonModule ()
|
||||||
mp_module.release ();
|
mp_module.release ();
|
||||||
mp_base_class.release ();
|
mp_base_class.release ();
|
||||||
|
|
||||||
delete_module ();
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
PythonModule::module ()
|
|
||||||
{
|
|
||||||
return mp_module.get ();
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
PythonModule::take_module ()
|
|
||||||
{
|
|
||||||
return mp_module.release ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PythonModule::delete_module ()
|
|
||||||
{
|
|
||||||
mp_module = PythonRef ();
|
|
||||||
mp_base_class = PythonRef ();
|
|
||||||
|
|
||||||
while (!m_methods_heap.empty ()) {
|
while (!m_methods_heap.empty ()) {
|
||||||
delete m_methods_heap.back ();
|
delete m_methods_heap.back ();
|
||||||
m_methods_heap.pop_back ();
|
m_methods_heap.pop_back ();
|
||||||
|
|
@ -2266,10 +2247,27 @@ PythonModule::delete_module ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
PythonModule::module ()
|
||||||
|
{
|
||||||
|
return mp_module.get ();
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
PythonModule::take_module ()
|
||||||
|
{
|
||||||
|
return mp_module.release ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PythonModule::init (const char *mod_name, const char *description)
|
PythonModule::init (const char *mod_name, const char *description)
|
||||||
{
|
{
|
||||||
m_mod_name = mod_name;
|
// do some checks before we create the module
|
||||||
|
tl_assert (mod_name != 0);
|
||||||
|
tl_assert (mp_module.get () == 0);
|
||||||
|
check (mod_name);
|
||||||
|
|
||||||
|
m_mod_name = pymod_name + "." + mod_name;
|
||||||
m_mod_description = description;
|
m_mod_description = description;
|
||||||
|
|
||||||
static PyMethodDef module_methods[] = {
|
static PyMethodDef module_methods[] = {
|
||||||
|
|
@ -2308,6 +2306,10 @@ PythonModule::init (const char *mod_name, const char *description)
|
||||||
void
|
void
|
||||||
PythonModule::init (const char *mod_name, PyObject *module)
|
PythonModule::init (const char *mod_name, PyObject *module)
|
||||||
{
|
{
|
||||||
|
// do some checks before we create the module
|
||||||
|
tl_assert (mp_module.get () == 0);
|
||||||
|
check (mod_name);
|
||||||
|
|
||||||
m_mod_name = mod_name;
|
m_mod_name = mod_name;
|
||||||
mp_module = PythonRef (module);
|
mp_module = PythonRef (module);
|
||||||
}
|
}
|
||||||
|
|
@ -2357,41 +2359,45 @@ PythonModule::python_doc (const gsi::MethodBase *method)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PythonModule::make_classes (const char *mod_name)
|
PythonModule::check (const char *mod_name)
|
||||||
{
|
{
|
||||||
|
if (! mod_name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether the new classes are self-contained within this module
|
// Check whether the new classes are self-contained within this module
|
||||||
if (mod_name) {
|
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
|
||||||
|
|
||||||
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
|
if (c->module () != mod_name) {
|
||||||
|
// don't handle classes outside this module
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (c->module () != mod_name) {
|
if (m_rev_cls_map.find (&*c) != m_rev_cls_map.end ()) {
|
||||||
// don't handle classes outside this module
|
// don't handle classes twice
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_rev_cls_map.find (&*c) != m_rev_cls_map.end ()) {
|
// All child classes must originate from this module or be known already
|
||||||
// don't handle classes twice
|
for (tl::weak_collection<gsi::ClassBase>::const_iterator cc = c->begin_child_classes (); cc != c->end_child_classes (); ++cc) {
|
||||||
continue;
|
if (m_rev_cls_map.find (cc->declaration ()) == m_rev_cls_map.end ()
|
||||||
}
|
&& cc->module () != mod_name) {
|
||||||
|
throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Class %s from module %s depends on %s.%s (try 'import %s' before 'import %s')")), c->name (), mod_name, cc->module (), cc->name (), pymod_name + "." + cc->module (), pymod_name + "." + mod_name));
|
||||||
// All child classes must originate from this module or be known already
|
|
||||||
for (tl::weak_collection<gsi::ClassBase>::const_iterator cc = c->begin_child_classes (); cc != c->end_child_classes (); ++cc) {
|
|
||||||
if (m_rev_cls_map.find (cc->declaration ()) == m_rev_cls_map.end ()
|
|
||||||
&& cc->module () != mod_name) {
|
|
||||||
throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Class %s from module %s depends on %s.%s (try 'import klayout.%s' before 'import klayout.%s')")), c->name (), mod_name, cc->module (), cc->name (), cc->module (), mod_name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Same for base class
|
|
||||||
if (c->base () && m_rev_cls_map.find (c->base ()) == m_rev_cls_map.end ()
|
|
||||||
&& c->base ()->module () != mod_name) {
|
|
||||||
throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Class %s from module %s depends on %s.%s (try 'import klayout.%s' before 'import klayout.%s')")), c->name (), mod_name, c->base ()->module (), c->base ()->name (), c->base ()->module (), mod_name));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Same for base class
|
||||||
|
if (c->base () && m_rev_cls_map.find (c->base ()) == m_rev_cls_map.end ()
|
||||||
|
&& c->base ()->module () != mod_name) {
|
||||||
|
throw tl::Exception (tl::sprintf (tl::to_string (QObject::tr ("Class %s from module %s depends on %s.%s (try 'import %s' before 'import %s')")), c->name (), mod_name, c->base ()->module (), c->base ()->name (), pymod_name + "." + c->base ()->module (), pymod_name + "." + mod_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PythonModule::make_classes (const char *mod_name)
|
||||||
|
{
|
||||||
PyObject *module = mp_module.get ();
|
PyObject *module = mp_module.get ();
|
||||||
|
|
||||||
// Prepare an __all__ index for the module
|
// Prepare an __all__ index for the module
|
||||||
|
|
@ -2451,6 +2457,9 @@ PythonModule::make_classes (const char *mod_name)
|
||||||
bool more_classes = true;
|
bool more_classes = true;
|
||||||
while (more_classes) {
|
while (more_classes) {
|
||||||
|
|
||||||
|
std::string reason_for_more;
|
||||||
|
bool any = false;
|
||||||
|
|
||||||
more_classes = false;
|
more_classes = false;
|
||||||
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
|
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
|
||||||
|
|
||||||
|
|
@ -2468,6 +2477,7 @@ PythonModule::make_classes (const char *mod_name)
|
||||||
for (tl::weak_collection<gsi::ClassBase>::const_iterator cc = c->begin_child_classes (); cc != c->end_child_classes (); ++cc) {
|
for (tl::weak_collection<gsi::ClassBase>::const_iterator cc = c->begin_child_classes (); cc != c->end_child_classes (); ++cc) {
|
||||||
tl_assert (cc->declaration () != 0);
|
tl_assert (cc->declaration () != 0);
|
||||||
if (m_rev_cls_map.find (cc->declaration ()) == m_rev_cls_map.end ()) {
|
if (m_rev_cls_map.find (cc->declaration ()) == m_rev_cls_map.end ()) {
|
||||||
|
reason_for_more = tl::sprintf ("child of class %s.%s not available (%s.%s)", c->module (), c->name (), cc->module (), cc->name ());
|
||||||
all_children_available = false;
|
all_children_available = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2480,6 +2490,7 @@ PythonModule::make_classes (const char *mod_name)
|
||||||
|
|
||||||
if (c->base () && m_rev_cls_map.find (c->base ()) == m_rev_cls_map.end ()) {
|
if (c->base () && m_rev_cls_map.find (c->base ()) == m_rev_cls_map.end ()) {
|
||||||
// can't produce this class yet. The base class needs to be handled first.
|
// can't produce this class yet. The base class needs to be handled first.
|
||||||
|
reason_for_more = tl::sprintf ("base of class %s.%s not available (%s.%s)", c->module (), c->name (), c->base ()->module (), c->base ()->name ());
|
||||||
more_classes = true;
|
more_classes = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2489,6 +2500,8 @@ PythonModule::make_classes (const char *mod_name)
|
||||||
|
|
||||||
// Create the class as a heap object, since that way we can dynamically extend the objects
|
// Create the class as a heap object, since that way we can dynamically extend the objects
|
||||||
|
|
||||||
|
any = true;
|
||||||
|
|
||||||
PythonRef bases (PyTuple_New (1));
|
PythonRef bases (PyTuple_New (1));
|
||||||
PyObject *base = mp_base_class.get ();
|
PyObject *base = mp_base_class.get ();
|
||||||
if (c->base () != 0) {
|
if (c->base () != 0) {
|
||||||
|
|
@ -2949,6 +2962,11 @@ PythonModule::make_classes (const char *mod_name)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! any && more_classes) {
|
||||||
|
// prevent infinite recursion
|
||||||
|
throw tl::Exception ("Internal error: infinite recursion on class building. Reason is: " + reason_for_more);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,16 +189,12 @@ public:
|
||||||
*/
|
*/
|
||||||
PyObject *take_module ();
|
PyObject *take_module ();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Deletes the PyModule object
|
|
||||||
*/
|
|
||||||
void delete_module ();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void add_python_doc (const gsi::ClassBase &cls, const MethodTable *mt, int mid, const std::string &doc);
|
void add_python_doc (const gsi::ClassBase &cls, const MethodTable *mt, int mid, const std::string &doc);
|
||||||
PyMethodDef *make_method_def ();
|
PyMethodDef *make_method_def ();
|
||||||
PyGetSetDef *make_getset_def ();
|
PyGetSetDef *make_getset_def ();
|
||||||
char *make_string (const std::string &s);
|
char *make_string (const std::string &s);
|
||||||
|
static void check (const char *mod_name);
|
||||||
|
|
||||||
std::list<std::string> m_string_heap;
|
std::list<std::string> m_string_heap;
|
||||||
std::vector<PyMethodDef *> m_methods_heap;
|
std::vector<PyMethodDef *> m_methods_heap;
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@ SOURCES = \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
||||||
LIBS += -lklayout_QtCore
|
LIBS += -lklayout_QtCore -lklayout_QtGui -lklayout_QtWidgets
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,18 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtCore module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtCoreExternals.h"
|
||||||
|
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
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
DEFINE_PYMOD(QtCore, "QtCore", "KLayout/Qt module 'QtCore'")
|
DEFINE_PYMOD(QtCore, "QtCore", "KLayout/Qt module 'QtCore'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtDesigner module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtDesignerExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTDESIGNER
|
||||||
|
|
||||||
DEFINE_PYMOD(QtDesigner, "QtDesigner", "KLayout/Qt module 'QtDesigner'")
|
DEFINE_PYMOD(QtDesigner, "QtDesigner", "KLayout/Qt module 'QtDesigner'")
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,9 @@ SOURCES = \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
||||||
LIBS += -lklayout_QtGui
|
LIBS += -lklayout_QtGui -lklayout_QtCore
|
||||||
|
|
||||||
|
equals(HAVE_QT5, "1") {
|
||||||
|
LIBS += -lklayout_QtWidgets
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,13 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtGui module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtGuiExternals.h"
|
||||||
|
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
|
||||||
|
|
||||||
DEFINE_PYMOD(QtGui, "QtGui", "KLayout/Qt module 'QtGui'")
|
DEFINE_PYMOD(QtGui, "QtGui", "KLayout/Qt module 'QtGui'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtMultimedia module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtMultimediaExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTMULTIMEDIA
|
||||||
|
|
||||||
DEFINE_PYMOD(QtMultimedia, "QtMultimedia", "KLayout/Qt module 'QtMultimedia'")
|
DEFINE_PYMOD(QtMultimedia, "QtMultimedia", "KLayout/Qt module 'QtMultimedia'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtNetwork module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtNetworkExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTNETWORK
|
||||||
|
|
||||||
DEFINE_PYMOD(QtNetwork, "QtNetwork", "KLayout/Qt module 'QtNetwork'")
|
DEFINE_PYMOD(QtNetwork, "QtNetwork", "KLayout/Qt module 'QtNetwork'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtPrintSupport module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtPrintSupportExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTPRINTSUPPORT
|
||||||
|
|
||||||
DEFINE_PYMOD(QtPrintSupport, "QtPrintSupport", "KLayout/Qt module 'QtPrintSupport'")
|
DEFINE_PYMOD(QtPrintSupport, "QtPrintSupport", "KLayout/Qt module 'QtPrintSupport'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtSql module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtSqlExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTSQL
|
||||||
|
|
||||||
DEFINE_PYMOD(QtSql, "QtSql", "KLayout/Qt module 'QtSql'")
|
DEFINE_PYMOD(QtSql, "QtSql", "KLayout/Qt module 'QtSql'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtSvg module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtSvgExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTSVG
|
||||||
|
|
||||||
DEFINE_PYMOD(QtSvg, "QtSvg", "KLayout/Qt module 'QtSvg'")
|
DEFINE_PYMOD(QtSvg, "QtSvg", "KLayout/Qt module 'QtSvg'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtWidgets module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtWidgetsExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTWIDGETS
|
||||||
|
|
||||||
DEFINE_PYMOD(QtWidgets, "QtWidgets", "KLayout/Qt module 'QtWidgets'")
|
DEFINE_PYMOD(QtWidgets, "QtWidgets", "KLayout/Qt module 'QtWidgets'")
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,7 @@ SOURCES = \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
||||||
LIBS += -lklayout_QtXml
|
LIBS += -lklayout_QtCore -lklayout_QtXml
|
||||||
|
|
||||||
|
# Because of stupid dependency of QtCore on QtGui and this on QtWidgets:
|
||||||
|
LIBS += -lklayout_QtGui -lklayout_QtWidgets
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,24 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtXml module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtXmlExternals.h"
|
||||||
|
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
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
DEFINE_PYMOD(QtXml, "QtXml", "KLayout/Qt module 'QtXml'")
|
DEFINE_PYMOD(QtXml, "QtXml", "KLayout/Qt module 'QtXml'")
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@ SOURCES = \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
||||||
LIBS += -lklayout_QtXmlPatterns
|
LIBS += -lklayout_QtXmlPatterns -lklayout_QtNetwork
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,13 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// To force linking of the QtXmlPatterns module
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtXmlPatternsExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTXMLPATTERNS
|
||||||
|
|
||||||
|
// To force linking of the QtNetwork module (some arguments
|
||||||
|
// are QNetworkAccessManager)
|
||||||
|
#include "../../gsiqt/qtbasic/gsiQtNetworkExternals.h"
|
||||||
|
FORCE_LINK_GSI_QTNETWORK
|
||||||
|
|
||||||
DEFINE_PYMOD(QtXmlPatterns, "QtXmlPatterns", "KLayout/Qt module 'QtXmlPatterns'")
|
DEFINE_PYMOD(QtXmlPatterns, "QtXmlPatterns", "KLayout/Qt module 'QtXmlPatterns'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,7 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// to force linking of the db module
|
||||||
|
#include "../../db/db/dbForceLink.h"
|
||||||
|
|
||||||
DEFINE_PYMOD(db, "db", "KLayout core module 'db'")
|
DEFINE_PYMOD(db, "db", "KLayout core module 'db'")
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,7 @@
|
||||||
|
|
||||||
#include "../pymodHelper.h"
|
#include "../pymodHelper.h"
|
||||||
|
|
||||||
|
// to force linking of the lay module
|
||||||
|
#include "../../lay/lay/layForceLink.h"
|
||||||
|
|
||||||
DEFINE_PYMOD(lay, "lay", "KLayout core module 'lay'")
|
DEFINE_PYMOD(lay, "lay", "KLayout core module 'lay'")
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ static PyObject *
|
||||||
module_init (const char *mod_name, const char *mod_description)
|
module_init (const char *mod_name, const char *mod_description)
|
||||||
{
|
{
|
||||||
static pya::PythonModule module;
|
static pya::PythonModule module;
|
||||||
std::string mod_qname (std::string ("pykl.") + mod_name);
|
|
||||||
|
|
||||||
PYA_TRY
|
PYA_TRY
|
||||||
|
|
||||||
|
|
@ -48,14 +47,13 @@ module_init (const char *mod_name, const char *mod_description)
|
||||||
// required for the tiling processor for example
|
// required for the tiling processor for example
|
||||||
gsi::initialize_expressions ();
|
gsi::initialize_expressions ();
|
||||||
|
|
||||||
module.init (mod_qname.c_str (), mod_description);
|
module.init (mod_name, mod_description);
|
||||||
module.make_classes (mod_name);
|
module.make_classes (mod_name);
|
||||||
|
|
||||||
return module.take_module ();
|
return module.take_module ();
|
||||||
|
|
||||||
PYA_CATCH_ANYWHERE
|
PYA_CATCH_ANYWHERE
|
||||||
|
|
||||||
module.delete_module ();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue