bindings work

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2018-02-13 06:51:20 +00:00
parent 09b02f009d
commit 259500af75
18 changed files with 1516 additions and 26 deletions

View file

@ -1,14 +1,24 @@
%module KtCore
%include "tricks.i"
%include "core/qbytearray.i"
%include "core/qchar.i"
%include "core/qeasingcurve.i"
%include "core/qjsonarray.i"
%include "core/qjsondocument.i"
%include "core/qjsonobject.i"
%include "core/qjsonvalue.i"
%include "core/qlist.i"
%include "core/qobject.i"
%include "core/qregexp.i"
%include "core/qset.i"
%include "core/qstring.i"
%include "core/qstringlist.i"
%include "core/qvariant.i"
%include "core/qvector.i"
// maybe rename? (e.g. QCharList)
%template(QListInt) QList<int>;
%template(QListQByteArray) QList<QByteArray>;
%template(QListQChar) QList<QChar>;
@ -24,21 +34,19 @@
%template(QVectorQChar) QVector<QChar>;
%template(QVectorQString) QVector<QString>;
// %template(QVariantList) QList<QVariant>;
// %template(QVariantMap) QMap<QVariant>;
// %template(QVariantHash) QHash<QVariant>;
%{
#include "QtCore/QObject"
#include "QtCore/QCoreApplication"
#include "QtCore/QFile"
QT_USE_NAMESPACE
%}
class QObject {
public:
QObject(QObject *parent = Q_NULLPTR);
virtual ~QObject();
};
// temporary implementations for testing purposes
class QCoreApplication : public QObject {
public:
QCoreApplication(int argc, char *argv[]);
@ -54,3 +62,30 @@ public:
bool exists() const;
};
// stub implementations for QVariant testing
class QBitArray {
public:
QBitArray();
~QBitArray();
};
class QDataStream;
class QDate;
class QDateTime;
class QLine;
class QLineF;
class QLocale;
class QMatrix;
class QTransform;
class QTime;
class QPoint;
class QPointF;
class QSize;
class QSizeF;
class QRect;
class QRectF;
class QTextFormat;
class QTextLength;
class QUrl;

View file

@ -1,6 +1,12 @@
%module KtGui
%include <KtCore.i>
%include "tricks.i"
// temporary for QCoreApplication reference
%include "KtCore.i"
%include "gui/qfontinfo.i"
%include "gui/qfontmetrics.i"
%include "gui/qwidget.i"
%{
#include "QtGui/QtGui"
@ -23,15 +29,6 @@ protected:
QPaintDevice();
};
class QWidget : public QObject, public QPaintDevice{
public:
QWidget(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);
~QWidget();
void setWindowTitle(const QString title);
void show();
};
class QMainWindow : public QWidget {
public:
QMainWindow(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = 0);

4
bindings/TODO Normal file
View file

@ -0,0 +1,4 @@
- QObject is probably not working as intended
- QVariant is almost not working because it's template and function magic
- QList, QSet and QVector template for types that are not implemented yet
- properties, slots, signals, etc.

View file

@ -3,9 +3,6 @@
QT_USE_NAMESPACE
%}
#undef QT_FASTCALL
#define QT_FASTCALL
class QLatin1Char
{
public:

View file

@ -0,0 +1,60 @@
%{
#include "QtCore/qeasingcurve.h"
QT_USE_NAMESPACE
%}
class QEasingCurve
{
Q_GADGET
Q_ENUMS(Type)
public:
enum Type {
Linear,
InQuad, OutQuad, InOutQuad, OutInQuad,
InCubic, OutCubic, InOutCubic, OutInCubic,
InQuart, OutQuart, InOutQuart, OutInQuart,
InQuint, OutQuint, InOutQuint, OutInQuint,
InSine, OutSine, InOutSine, OutInSine,
InExpo, OutExpo, InOutExpo, OutInExpo,
InCirc, OutCirc, InOutCirc, OutInCirc,
InElastic, OutElastic, InOutElastic, OutInElastic,
InBack, OutBack, InOutBack, OutInBack,
InBounce, OutBounce, InOutBounce, OutInBounce,
InCurve, OutCurve, SineCurve, CosineCurve,
Custom, NCurveTypes
};
QEasingCurve(Type type = Linear);
QEasingCurve(const QEasingCurve &other);
~QEasingCurve();
QEasingCurve &operator=(const QEasingCurve &other);
bool operator==(const QEasingCurve &other) const;
bool operator!=(const QEasingCurve &other) const;
qreal amplitude() const;
void setAmplitude(qreal amplitude);
qreal period() const;
void setPeriod(qreal period);
qreal overshoot() const;
void setOvershoot(qreal overshoot);
Type type() const;
void setType(Type type);
typedef qreal (*EasingFunction)(qreal progress);
void setCustomType(EasingFunction func);
EasingFunction customType() const;
qreal valueForProgress(qreal progress) const;
};
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QEasingCurve &item);
#endif
#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &, const QEasingCurve&);
QDataStream &operator>>(QDataStream &, QEasingCurve &);
#endif

View file

@ -0,0 +1,52 @@
%{
#include "QtCore/qjsonarray.h"
QT_USE_NAMESPACE
%}
class QJsonArray
{
public:
QJsonArray();
~QJsonArray();
QJsonArray(const QJsonArray &other);
QJsonArray &operator =(const QJsonArray &other);
static QJsonArray fromStringList(const QStringList &list);
static QJsonArray fromVariantList(const QVariantList &list);
QVariantList toVariantList() const;
int size() const;
int count() const;
bool isEmpty() const;
QJsonValue at(int i) const;
QJsonValue first() const;
QJsonValue last() const;
void prepend(const QJsonValue &value);
void append(const QJsonValue &value);
void removeAt(int i);
QJsonValue takeAt(int i);
void removeFirst();
void removeLast();
void insert(int i, const QJsonValue &value);
void replace(int i, const QJsonValue &value);
bool contains(const QJsonValue &element) const;
QJsonValueRef operator[](int i);
QJsonValue operator[](int i) const;
bool operator==(const QJsonArray &other) const;
bool operator!=(const QJsonArray &other) const;
// stl compatibility
void push_back(const QJsonValue &t);
void push_front(const QJsonValue &t);
void pop_front();
void pop_back();
bool empty();
};
QDebug operator<<(QDebug, const QJsonArray &);

View file

@ -0,0 +1,87 @@
%{
#include "QtCore/qjsondocument.h"
QT_USE_NAMESPACE
%}
struct QJsonParseError {
enum ParseError {
NoError = 0,
UnterminatedObject,
MissingNameSeparator,
UnterminatedArray,
MissingValueSeparator,
IllegalValue,
TerminationByNumber,
IllegalNumber,
IllegalEscapeSequence,
IllegalUTF8String,
UnterminatedString,
MissingObject,
DeepNesting,
DocumentTooLarge
};
QString errorString() const;
int offset;
ParseError error;
};
class QJsonDocument
{
public:
#ifdef Q_LITTLE_ENDIAN
static const uint BinaryFormatTag = ('q') | ('b' << 8) | ('j' << 16) | ('s' << 24);
#else
static const uint BinaryFormatTag = ('q' << 24) | ('b' << 16) | ('j' << 8) | ('s');
#endif
QJsonDocument();
QJsonDocument(const QJsonObject &object);
QJsonDocument(const QJsonArray &array);
~QJsonDocument();
QJsonDocument(const QJsonDocument &other);
QJsonDocument &operator =(const QJsonDocument &other);
enum DataValidation {
Validate,
BypassValidation
};
static QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate);
const char *rawData(int *size) const;
static QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate);
QByteArray toBinaryData() const;
static QJsonDocument fromVariant(const QVariant &variant);
QVariant toVariant() const;
enum JsonFormat {
Indented,
Compact
};
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0);
QByteArray toJson(JsonFormat format = Indented) const;
bool isEmpty() const;
bool isArray() const;
bool isObject() const;
QJsonObject object() const;
QJsonArray array() const;
void setObject(const QJsonObject &object);
void setArray(const QJsonArray &array);
bool operator==(const QJsonDocument &other) const;
bool operator!=(const QJsonDocument &other) const;
bool isNull() const;
};
QDebug operator<<(QDebug, const QJsonDocument &);

View file

@ -0,0 +1,41 @@
%{
#include "QtCore/qjsonobject.h"
QT_USE_NAMESPACE
%}
class QJsonObject
{
public:
QJsonObject();
~QJsonObject();
QJsonObject(const QJsonObject &other);
QJsonObject &operator =(const QJsonObject &other);
static QJsonObject fromVariantMap(const QVariantMap &map);
QVariantMap toVariantMap() const;
static QJsonObject fromVariantHash(const QVariantHash &map);
QVariantHash toVariantHash() const;
QStringList keys() const;
int size() const;
int count() const;
int length() const;
bool isEmpty() const;
QJsonValue value(const QString &key) const;
QJsonValue operator[] (const QString &key) const;
QJsonValueRef operator[] (const QString &key);
void remove(const QString &key);
QJsonValue take(const QString &key);
bool contains(const QString &key) const;
bool operator==(const QJsonObject &other) const;
bool operator!=(const QJsonObject &other) const;
// STL compatibility
bool empty() const;
};
QDebug operator<<(QDebug, const QJsonObject &);

View file

@ -0,0 +1,91 @@
%{
#include "QtCore/qjsonvalue.h"
QT_USE_NAMESPACE
%}
class QJsonValue
{
public:
enum Type {
Null = 0x0,
Bool = 0x1,
Double = 0x2,
String = 0x3,
Array = 0x4,
Object = 0x5,
Undefined = 0x80
};
QJsonValue(Type = Null);
QJsonValue(bool b);
QJsonValue(double n);
QJsonValue(int n);
QJsonValue(qint64 n);
QJsonValue(const QString &s);
QJsonValue(QLatin1String s);
QJsonValue(const QJsonArray &a);
QJsonValue(const QJsonObject &o);
~QJsonValue();
QJsonValue(const QJsonValue &other);
QJsonValue &operator =(const QJsonValue &other);
static QJsonValue fromVariant(const QVariant &variant);
QVariant toVariant() const;
Type type() const;
bool isNull() const;
bool isBool() const;
bool isDouble() const;
bool isString() const;
bool isArray() const;
bool isObject() const;
bool isUndefined() const;
bool toBool(bool defaultValue = false) const;
int toInt(int defaultValue = 0) const;
double toDouble(double defaultValue = 0) const;
QString toString(const QString &defaultValue = QString()) const;
QJsonArray toArray() const;
QJsonArray toArray(const QJsonArray &defaultValue) const;
QJsonObject toObject() const;
QJsonObject toObject(const QJsonObject &defaultValue) const;
bool operator==(const QJsonValue &other) const;
bool operator!=(const QJsonValue &other) const;
};
class QJsonValueRef
{
public:
QJsonValueRef(QJsonArray *array, int idx);
QJsonValueRef(QJsonObject *object, int idx);
operator QJsonValue() const;
QJsonValueRef &operator = (const QJsonValue &val);
QJsonValueRef &operator = (const QJsonValueRef &val);
QJsonValue::Type type() const;
bool isNull() const;
bool isBool() const;
bool isDouble() const;
bool isString() const;
bool isArray() const;
bool isObject() const;
bool isUndefined() const;
bool toBool() const;
int toInt() const;
double toDouble() const;
QString toString() const;
QJsonArray toArray() const;
QJsonObject toObject() const;
bool operator==(const QJsonValue &other) const;
bool operator!=(const QJsonValue &other) const;
};
// QJsonValueRefPtr and QJsonValuePtr not implemented
QDebug operator<<(QDebug, const QJsonValue &);

155
bindings/core/qobject.i Normal file
View file

@ -0,0 +1,155 @@
%{
#include "QtCore/qobject.h"
QT_USE_NAMESPACE
%}
#ifndef QT_NO_QOBJECT
class QObject
{
/*
Q_OBJECT
Q_PROPERTY(QString objectName READ objectName WRITE setObjectName)
*/
public:
Q_INVOKABLE explicit QObject(QObject *parent = Q_NULLPTR);
virtual ~QObject();
virtual bool event(QEvent *);
virtual bool eventFilter(QObject *, QEvent *);
#ifdef QT_NO_TRANSLATION
static QString tr(const char *sourceText, const char * = Q_NULLPTR, int = -1);
#ifndef QT_NO_TEXTCODEC
static QString trUtf8(const char *sourceText, const char * = Q_NULLPTR, int = -1);
#endif
#endif //QT_NO_TRANSLATION
QString objectName() const;
void setObjectName(const QString &name);
bool isWidgetType() const;
bool signalsBlocked() const;
bool blockSignals(bool b);
QThread *thread() const;
void moveToThread(QThread *thread);
int startTimer(int interval);
void killTimer(int id);
template<typename T>
findChild(const QString &aName = QString()) const;
template<typename T>
QList<T> findChildren(const QString &aName = QString()) const;
#ifndef QT_NO_REGEXP
template<typename T>
QList<T> findChildren(const QRegExp &re) const;
#endif
const QObjectList &children() const;
void setParent(QObject *);
void installEventFilter(QObject *);
void removeEventFilter(QObject *);
static bool connect(const QObject *sender, const char *signal,
const QObject *receiver, const char *member,
Qt::ConnectionType type = Qt::AutoConnection
);
static bool connect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &method,
Qt::ConnectionType type = Qt::AutoConnection
);
bool connect(const QObject *sender, const char *signal,
const char *member,
Qt::ConnectionType type = Qt::AutoConnection
) const;
static bool disconnect(const QObject *sender, const char *signal,
const QObject *receiver, const char *member);
static bool disconnect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &member);
bool disconnect(const char *signal = Q_NULLPTR,
const QObject *receiver = Q_NULLPTR, const char *member = Q_NULLPTR);
bool disconnect(const QObject *receiver, const char *member = Q_NULLPTR);
void dumpObjectTree();
void dumpObjectInfo();
#ifndef QT_NO_PROPERTIES
bool setProperty(const char *name, const QVariant &value);
QVariant property(const char *name) const;
QList<QByteArray> dynamicPropertyNames() const;
#endif // QT_NO_PROPERTIES
Q_SIGNALS:
void destroyed(QObject * = Q_NULLPTR);
public:
QObject *parent() const;
bool inherits(const char *classname) const;
public Q_SLOTS:
void deleteLater();
protected:
QObject *sender() const;
int senderSignalIndex() const;
int receivers(const char* signal) const;
virtual void timerEvent(QTimerEvent *);
virtual void childEvent(QChildEvent *);
virtual void customEvent(QEvent *);
virtual void connectNotify(const char *signal);
virtual void disconnectNotify(const char *signal);
QObject(QObjectPrivate &dd, QObject *parent = Q_NULLPTR);
QObjectData* d_ptr;
static const QMetaObject staticQtMetaObject;
};
/* TODO
template <class T>
T qobject_cast(QObject *object);
template <class T>
T qobject_cast(const QObject *object);
template <class T> const char * qobject_interface_iid()
{ return Q_NULLPTR; }
#ifndef Q_MOC_RUN
# define Q_DECLARE_INTERFACE(IFace, IId) \
QT_BEGIN_NAMESPACE \
template <> const char *qobject_interface_iid<IFace *>() \
{ return IId; } \
template <> IFace *qobject_cast<IFace *>(QObject *object) \
{ return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : Q_NULLPTR)); } \
template <> IFace *qobject_cast<IFace *>(const QObject *object) \
{ return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : Q_NULLPTR)); } \
QT_END_NAMESPACE
#endif // Q_MOC_RUN
*/
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug, const QObject *);
#endif
#endif // QT_NO_QOBJECT
void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
const QMetaObject &mo, QList<void *> *list);
QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo);

View file

@ -3,9 +3,6 @@
QT_USE_NAMESPACE
%}
#undef Q_REQUIRED_RESULT
#define Q_REQUIRED_RESULT
class QString
{
public:

View file

@ -3,8 +3,6 @@
QT_USE_NAMESPACE
%}
#define Q_NO_USING_KEYWORD
typedef QListIterator<QString> QStringListIterator;
typedef QMutableListIterator<QString> QMutableStringListIterator;

269
bindings/core/qvariant.i Normal file
View file

@ -0,0 +1,269 @@
%{
#include "QtCore/qvariant.h"
QT_USE_NAMESPACE
%}
template <typename T>
QVariant qVariantFromValue(const T &);
template<typename T>
T qvariant_cast(const QVariant &);
class QVariant
{
public:
enum Type {
Invalid = QMetaType::Void,
Bool = QMetaType::Bool,
Int = QMetaType::Int,
UInt = QMetaType::UInt,
LongLong = QMetaType::LongLong,
ULongLong = QMetaType::ULongLong,
Double = QMetaType::Double,
Char = QMetaType::QChar,
Map = QMetaType::QVariantMap,
List = QMetaType::QVariantList,
String = QMetaType::QString,
StringList = QMetaType::QStringList,
ByteArray = QMetaType::QByteArray,
BitArray = QMetaType::QBitArray,
Date = QMetaType::QDate,
Time = QMetaType::QTime,
DateTime = QMetaType::QDateTime,
Url = QMetaType::QUrl,
Locale = QMetaType::QLocale,
Rect = QMetaType::QRect,
RectF = QMetaType::QRectF,
Size = QMetaType::QSize,
SizeF = QMetaType::QSizeF,
Line = QMetaType::QLine,
LineF = QMetaType::QLineF,
Point = QMetaType::QPoint,
PointF = QMetaType::QPointF,
RegExp = QMetaType::QRegExp,
Hash = QMetaType::QVariantHash,
EasingCurve = QMetaType::QEasingCurve,
JsonValue = QMetaType::QJsonValue,
JsonObject = QMetaType::QJsonObject,
JsonArray = QMetaType::QJsonArray,
JsonDocument = QMetaType::QJsonDocument,
LastCoreType = QMetaType::LastCoreType,
Font = QMetaType::QFont,
Pixmap = QMetaType::QPixmap,
Brush = QMetaType::QBrush,
Color = QMetaType::QColor,
Palette = QMetaType::QPalette,
Icon = QMetaType::QIcon,
Image = QMetaType::QImage,
Polygon = QMetaType::QPolygon,
Region = QMetaType::QRegion,
Bitmap = QMetaType::QBitmap,
Cursor = QMetaType::QCursor,
SizePolicy = QMetaType::QSizePolicy,
KeySequence = QMetaType::QKeySequence,
Pen = QMetaType::QPen,
TextLength = QMetaType::QTextLength,
TextFormat = QMetaType::QTextFormat,
Matrix = QMetaType::QMatrix,
Transform = QMetaType::QTransform,
Matrix4x4 = QMetaType::QMatrix4x4,
Vector2D = QMetaType::QVector2D,
Vector3D = QMetaType::QVector3D,
Vector4D = QMetaType::QVector4D,
Quaternion = QMetaType::QQuaternion,
LastGuiType = QMetaType::LastGuiType,
UserType = 127,
LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
};
QVariant();
~QVariant();
QVariant(Type type);
QVariant(int typeOrUserType, const void *copy);
QVariant(int typeOrUserType, const void *copy, uint flags);
QVariant(const QVariant &other);
#ifndef QT_NO_DATASTREAM
QVariant(QDataStream &s);
#endif
QVariant(int i);
QVariant(uint ui);
QVariant(qlonglong ll);
QVariant(qulonglong ull);
QVariant(bool b);
QVariant(double d);
QVariant(float f);
#ifndef QT_NO_CAST_FROM_ASCII
QVariant(const char *str);
#endif
QVariant(const QByteArray &bytearray);
QVariant(const QBitArray &bitarray);
QVariant(const QString &string);
QVariant(const QLatin1String &string);
QVariant(const QStringList &stringlist);
QVariant(const QChar &qchar);
QVariant(const QDate &date);
QVariant(const QTime &time);
QVariant(const QDateTime &datetime);
QVariant(const QList<QVariant> &list);
QVariant(const QMap<QString,QVariant> &map);
QVariant(const QHash<QString,QVariant> &hash);
#ifndef QT_NO_GEOM_VARIANT
QVariant(const QSize &size);
QVariant(const QSizeF &size);
QVariant(const QPoint &pt);
QVariant(const QPointF &pt);
QVariant(const QLine &line);
QVariant(const QLineF &line);
QVariant(const QRect &rect);
QVariant(const QRectF &rect);
#endif
QVariant(const QUrl &url);
QVariant(const QLocale &locale);
#ifndef QT_NO_REGEXP
QVariant(const QRegExp &regExp);
#endif
QVariant(const QJsonValue &jsonValue);
QVariant(const QJsonObject &jsonObject);
QVariant(const QJsonArray &jsonArray);
QVariant(const QJsonDocument &jsonDocument);
#ifndef QT_BOOTSTRAPPED
QVariant(const QEasingCurve &easing);
#endif
QVariant& operator=(const QVariant &other);
#ifdef Q_COMPILER_RVALUE_REFS
QVariant &operator=(QVariant &&other);
#endif
void swap(QVariant &other);
Type type() const;
int userType() const;
const char *typeName() const;
bool canConvert(Type t) const;
bool convert(Type t);
bool isValid() const;
bool isNull() const;
void clear();
void detach();
bool isDetached() const;
int toInt(bool *ok = Q_NULLPTR) const;
uint toUInt(bool *ok = Q_NULLPTR) const;
qlonglong toLongLong(bool *ok = Q_NULLPTR) const;
qulonglong toULongLong(bool *ok = Q_NULLPTR) const;
bool toBool() const;
double toDouble(bool *ok = Q_NULLPTR) const;
float toFloat(bool *ok = Q_NULLPTR) const;
qreal toReal(bool *ok = Q_NULLPTR) const;
QByteArray toByteArray() const;
QBitArray toBitArray() const;
QString toString() const;
QStringList toStringList() const;
QChar toChar() const;
QDate toDate() const;
QTime toTime() const;
QDateTime toDateTime() const;
QList<QVariant> toList() const;
QMap<QString, QVariant> toMap() const;
QHash<QString, QVariant> toHash() const;
#ifndef QT_NO_GEOM_VARIANT
QPoint toPoint() const;
QPointF toPointF() const;
QRect toRect() const;
QSize toSize() const;
QSizeF toSizeF() const;
QLine toLine() const;
QLineF toLineF() const;
QRectF toRectF() const;
#endif
QUrl toUrl() const;
QLocale toLocale() const;
#ifndef QT_NO_REGEXP
QRegExp toRegExp() const;
#endif
#ifndef QT_BOOTSTRAPPED
QJsonValue toJsonValue() const;
QJsonObject toJsonObject() const;
QJsonArray toJsonArray() const;
QJsonDocument toJsonDocument() const;
QEasingCurve toEasingCurve() const;
#endif
#ifndef QT_NO_DATASTREAM
void load(QDataStream &ds);
void save(QDataStream &ds) const;
#endif
static const char *typeToName(Type type);
static Type nameToType(const char *name);
void *data();
const void *constData() const;
const void *data() const;
template<typename T>
void setValue(const T &value);
template<typename T>
T value() const;
template<typename T>
static QVariant fromValue(const T &value);
template<typename T>
bool canConvert() const;
bool operator==(const QVariant &v) const;
bool operator!=(const QVariant &v) const;
};
bool qvariant_cast_helper(const QVariant &v, QVariant::Type tp, void *ptr);
template <typename T>
QVariant qVariantFromValue(const T &t);
template <>
QVariant qVariantFromValue(const QVariant &t);
template <typename T>
void qVariantSetValue(QVariant &v, const T &t);
template <>
void qVariantSetValue<QVariant>(QVariant &v, const QVariant &t);
template<typename T>
void QVariant::setValue(const T &avalue);
#ifndef QT_NO_DATASTREAM
QDataStream& operator>> (QDataStream& s, QVariant& p);
QDataStream& operator<< (QDataStream& s, const QVariant& p);
QDataStream& operator>> (QDataStream& s, QVariant::Type& p);
QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
#endif
#ifndef QT_MOC
template<typename T> T qvariant_cast(const QVariant &v);
template<> QVariant qvariant_cast<QVariant>(const QVariant &v);
#endif // QT_MOC
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug, const QVariant &);
QDebug operator<<(QDebug, const QVariant::Type);
#endif

31
bindings/gui/qfontinfo.i Normal file
View file

@ -0,0 +1,31 @@
%{
#include "QtGui/qfontinfo.h"
QT_USE_NAMESPACE
%}
class QFontInfo
{
public:
QFontInfo(const QFont &);
QFontInfo(const QFontInfo &);
~QFontInfo();
QFontInfo &operator=(const QFontInfo &);
QString family() const;
QString styleName() const;
int pixelSize() const;
int pointSize() const;
qreal pointSizeF() const;
bool italic() const;
QFont::Style style() const;
int weight() const;
bool bold() const;
bool underline() const;
bool overline() const;
bool strikeOut() const;
bool fixedPitch() const;
QFont::StyleHint styleHint() const;
bool exactMatch() const;
};

115
bindings/gui/qfontmetrics.i Normal file
View file

@ -0,0 +1,115 @@
%{
#include "QtGui/qfontmetrics.h"
QT_USE_NAMESPACE
%}
class QFontMetrics
{
public:
QFontMetrics(const QFont &);
QFontMetrics(const QFont &, QPaintDevice *pd);
QFontMetrics(const QFontMetrics &);
~QFontMetrics();
QFontMetrics &operator=(const QFontMetrics &);
#ifdef Q_COMPILER_RVALUE_REFS
QFontMetrics &operator=(QFontMetrics &&other);
#endif
int ascent() const;
int descent() const;
int height() const;
int leading() const;
int lineSpacing() const;
int minLeftBearing() const;
int minRightBearing() const;
int maxWidth() const;
int xHeight() const;
int averageCharWidth() const;
bool inFont(QChar) const;
bool inFontUcs4(uint ucs4) const;
int leftBearing(QChar) const;
int rightBearing(QChar) const;
int width(const QString &, int len = -1) const;
int width(const QString &, int len, int flags) const;
int width(QChar) const;
int charWidth(const QString &str, int pos) const;
QRect boundingRect(QChar) const;
QRect boundingRect(const QString &text) const;
QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops=0, int *tabarray=0) const;
QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text,
int tabstops=0, int *tabarray=0) const;
QSize size(int flags, const QString& str, int tabstops=0, int *tabarray=0) const;
QRect tightBoundingRect(const QString &text) const;
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags = 0) const;
int underlinePos() const;
int overlinePos() const;
int strikeOutPos() const;
int lineWidth() const;
bool operator==(const QFontMetrics &other) const;
bool operator !=(const QFontMetrics &other) const;
};
class QFontMetricsF
{
public:
QFontMetricsF(const QFont &);
QFontMetricsF(const QFont &, QPaintDevice *pd);
QFontMetricsF(const QFontMetrics &);
QFontMetricsF(const QFontMetricsF &);
~QFontMetricsF();
QFontMetricsF &operator=(const QFontMetricsF &);
QFontMetricsF &operator=(const QFontMetrics &);
#ifdef Q_COMPILER_RVALUE_REFS
QFontMetricsF &operator=(QFontMetricsF &&other);
#endif
qreal ascent() const;
qreal descent() const;
qreal height() const;
qreal leading() const;
qreal lineSpacing() const;
qreal minLeftBearing() const;
qreal minRightBearing() const;
qreal maxWidth() const;
qreal xHeight() const;
qreal averageCharWidth() const;
bool inFont(QChar) const;
bool inFontUcs4(uint ucs4) const;
qreal leftBearing(QChar) const;
qreal rightBearing(QChar) const;
qreal width(const QString &string) const;
qreal width(QChar) const;
QRectF boundingRect(const QString &string) const;
QRectF boundingRect(QChar) const;
QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops=0, int *tabarray=0) const;
QSizeF size(int flags, const QString& str, int tabstops=0, int *tabarray=0) const;
QRectF tightBoundingRect(const QString &text) const;
QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags = 0) const;
qreal underlinePos() const;
qreal overlinePos() const;
qreal strikeOutPos() const;
qreal lineWidth() const;
bool operator==(const QFontMetricsF &other) const;
bool operator !=(const QFontMetricsF &other) const;
};

533
bindings/gui/qwidget.i Normal file
View file

@ -0,0 +1,533 @@
%{
#include "QtGui/qwidget.h"
QT_USE_NAMESPACE
%}
class QWidget : public QObject, public QPaintDevice
{
Q_OBJECT
Q_PROPERTY(bool modal READ isModal)
Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
Q_PROPERTY(QRect frameGeometry READ frameGeometry)
Q_PROPERTY(QRect normalGeometry READ normalGeometry)
Q_PROPERTY(int x READ x)
Q_PROPERTY(int y READ y)
Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false)
Q_PROPERTY(QSize frameSize READ frameSize)
Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false)
Q_PROPERTY(int width READ width)
Q_PROPERTY(int height READ height)
Q_PROPERTY(QRect rect READ rect)
Q_PROPERTY(QRect childrenRect READ childrenRect)
Q_PROPERTY(QRegion childrenRegion READ childrenRegion)
Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy)
Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false)
Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false)
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false)
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false)
Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement)
Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
Q_PROPERTY(QFont font READ font WRITE setFont)
#ifndef QT_NO_CURSOR
Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
#endif
Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking)
Q_PROPERTY(bool isActiveWindow READ isActiveWindow)
Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy)
Q_PROPERTY(bool focus READ hasFocus)
Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy)
Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false)
Q_PROPERTY(bool minimized READ isMinimized)
Q_PROPERTY(bool maximized READ isMaximized)
Q_PROPERTY(bool fullScreen READ isFullScreen)
Q_PROPERTY(QSize sizeHint READ sizeHint)
Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint)
Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow)
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow)
Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow)
Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow)
Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow)
#ifndef QT_NO_TOOLTIP
Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
#endif
#ifndef QT_NO_STATUSTIP
Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip)
#endif
#ifndef QT_NO_WHATSTHIS
Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
#endif
#ifndef QT_NO_ACCESSIBILITY
Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName)
Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription)
#endif
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground)
#ifndef QT_NO_STYLE_STYLESHEET
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
#endif
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale)
Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow)
public:
enum RenderFlags {
DrawWindowBackground = 0x1,
DrawChildren = 0x2,
IgnoreMask = 0x4
};
QWidget(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = 0);
~QWidget();
int devType() const;
WId winId() const;
void createWinId(); // internal, going away
WId internalWinId() const;
WId effectiveWinId() const;
// GUI style setting
QStyle *style() const;
void setStyle(QStyle *);
// Widget types and states
bool isTopLevel() const;
bool isWindow() const;
bool isModal() const;
Qt::WindowModality windowModality() const;
void setWindowModality(Qt::WindowModality windowModality);
bool isEnabled() const;
bool isEnabledTo(QWidget*) const;
bool isEnabledToTLW() const;
public Q_SLOTS:
void setEnabled(bool);
void setDisabled(bool);
void setWindowModified(bool);
// Widget coordinates
public:
QRect frameGeometry() const;
const QRect &geometry() const;
QRect normalGeometry() const;
int x() const;
int y() const;
QPoint pos() const;
QSize frameSize() const;
QSize size() const;
int width() const;
int height() const;
QRect rect() const;
QRect childrenRect() const;
QRegion childrenRegion() const;
QSize minimumSize() const;
QSize maximumSize() const;
int minimumWidth() const;
int minimumHeight() const;
int maximumWidth() const;
int maximumHeight() const;
void setMinimumSize(const QSize &);
void setMinimumSize(int minw, int minh);
void setMaximumSize(const QSize &);
void setMaximumSize(int maxw, int maxh);
void setMinimumWidth(int minw);
void setMinimumHeight(int minh);
void setMaximumWidth(int maxw);
void setMaximumHeight(int maxh);
QSize sizeIncrement() const;
void setSizeIncrement(const QSize &);
void setSizeIncrement(int w, int h);
QSize baseSize() const;
void setBaseSize(const QSize &);
void setBaseSize(int basew, int baseh);
void setFixedSize(const QSize &);
void setFixedSize(int w, int h);
void setFixedWidth(int w);
void setFixedHeight(int h);
// Widget coordinate mapping
QPoint mapToGlobal(const QPoint &) const;
QPoint mapFromGlobal(const QPoint &) const;
QPoint mapToParent(const QPoint &) const;
QPoint mapFromParent(const QPoint &) const;
QPoint mapTo(QWidget *, const QPoint &) const;
QPoint mapFrom(QWidget *, const QPoint &) const;
QWidget *window() const;
QWidget *nativeParentWidget() const;
QWidget *topLevelWidget() const;
// Widget appearance functions
const QPalette &palette() const;
void setPalette(const QPalette &);
void setBackgroundRole(QPalette::ColorRole);
QPalette::ColorRole backgroundRole() const;
void setForegroundRole(QPalette::ColorRole);
QPalette::ColorRole foregroundRole() const;
const QFont &font() const;
void setFont(const QFont &);
QFontMetrics fontMetrics() const;
QFontInfo fontInfo() const;
#ifndef QT_NO_CURSOR
QCursor cursor() const;
void setCursor(const QCursor &);
void unsetCursor();
#endif
void setMouseTracking(bool enable);
bool hasMouseTracking() const;
bool underMouse() const;
void setMask(const QBitmap &);
void setMask(const QRegion &);
QRegion mask() const;
void clearMask();
void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(),
const QRegion &sourceRegion = QRegion(),
RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
void render(QPainter *painter, const QPoint &targetOffset = QPoint(),
const QRegion &sourceRegion = QRegion(),
RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
#ifndef QT_NO_GRAPHICSEFFECT
QGraphicsEffect *graphicsEffect() const;
void setGraphicsEffect(QGraphicsEffect *effect);
#endif //QT_NO_GRAPHICSEFFECT
#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
#endif
public Q_SLOTS:
void setWindowTitle(const QString &);
#ifndef QT_NO_STYLE_STYLESHEET
void setStyleSheet(const QString& styleSheet);
#endif
public:
#ifndef QT_NO_STYLE_STYLESHEET
QString styleSheet() const;
#endif
QString windowTitle() const;
void setWindowIcon(const QIcon &icon);
QIcon windowIcon() const;
void setWindowIconText(const QString &);
QString windowIconText() const;
void setWindowRole(const QString &);
QString windowRole() const;
void setWindowFilePath(const QString &filePath);
QString windowFilePath() const;
void setWindowOpacity(qreal level);
qreal windowOpacity() const;
bool isWindowModified() const;
#ifndef QT_NO_TOOLTIP
void setToolTip(const QString &);
QString toolTip() const;
#endif
#ifndef QT_NO_STATUSTIP
void setStatusTip(const QString &);
QString statusTip() const;
#endif
#ifndef QT_NO_WHATSTHIS
void setWhatsThis(const QString &);
QString whatsThis() const;
#endif
#ifndef QT_NO_ACCESSIBILITY
QString accessibleName() const;
void setAccessibleName(const QString &name);
QString accessibleDescription() const;
void setAccessibleDescription(const QString &description);
#endif
void setLayoutDirection(Qt::LayoutDirection direction);
Qt::LayoutDirection layoutDirection() const;
void unsetLayoutDirection();
void setLocale(const QLocale &locale);
QLocale locale() const;
void unsetLocale();
bool isRightToLeft() const;
bool isLeftToRight() const;
public Q_SLOTS:
void setFocus();
public:
bool isActiveWindow() const;
void activateWindow();
void clearFocus();
void setFocus(Qt::FocusReason reason);
Qt::FocusPolicy focusPolicy() const;
void setFocusPolicy(Qt::FocusPolicy policy);
bool hasFocus() const;
static void setTabOrder(QWidget *, QWidget *);
void setFocusProxy(QWidget *);
QWidget *focusProxy() const;
Qt::ContextMenuPolicy contextMenuPolicy() const;
void setContextMenuPolicy(Qt::ContextMenuPolicy policy);
// Grab functions
void grabMouse();
#ifndef QT_NO_CURSOR
void grabMouse(const QCursor &);
#endif
void releaseMouse();
void grabKeyboard();
void releaseKeyboard();
#ifndef QT_NO_SHORTCUT
int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut);
void releaseShortcut(int id);
void setShortcutEnabled(int id, bool enable = true);
void setShortcutAutoRepeat(int id, bool enable = true);
#endif
static QWidget *mouseGrabber();
static QWidget *keyboardGrabber();
// Update/refresh functions
bool updatesEnabled() const;
void setUpdatesEnabled(bool enable);
#ifndef QT_NO_GRAPHICSVIEW
QGraphicsProxyWidget *graphicsProxyWidget() const;
#endif
public Q_SLOTS:
void update();
void repaint();
public:
void update(int x, int y, int w, int h);
void update(const QRect&);
void update(const QRegion&);
void repaint(int x, int y, int w, int h);
void repaint(const QRect &);
void repaint(const QRegion &);
public Q_SLOTS:
// Widget management functions
virtual void setVisible(bool visible);
void setHidden(bool hidden);
void show();
void hide();
void showMinimized();
void showMaximized();
void showFullScreen();
void showNormal();
bool close();
void raise();
void lower();
public:
void stackUnder(QWidget*);
void move(int x, int y);
void move(const QPoint &);
void resize(int w, int h);
void resize(const QSize &);
void setGeometry(int x, int y, int w, int h);
void setGeometry(const QRect &);
QByteArray saveGeometry() const;
bool restoreGeometry(const QByteArray &geometry);
void adjustSize();
bool isVisible() const;
bool isVisibleTo(const QWidget*) const;
bool isHidden() const;
bool isMinimized() const;
bool isMaximized() const;
bool isFullScreen() const;
Qt::WindowStates windowState() const;
void setWindowState(Qt::WindowStates state);
void overrideWindowState(Qt::WindowStates state);
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
QSizePolicy sizePolicy() const;
void setSizePolicy(QSizePolicy);
void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical);
virtual int heightForWidth(int) const;
QRegion visibleRegion() const;
void setContentsMargins(int left, int top, int right, int bottom);
void setContentsMargins(const QMargins &margins);
void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
QMargins contentsMargins() const;
QRect contentsRect() const;
public:
QLayout *layout() const;
void setLayout(QLayout *);
void updateGeometry();
void setParent(QWidget *parent);
void setParent(QWidget *parent, Qt::WindowFlags f);
void scroll(int dx, int dy);
void scroll(int dx, int dy, const QRect&);
// Misc. functions
QWidget *focusWidget() const;
QWidget *nextInFocusChain() const;
QWidget *previousInFocusChain() const;
// drag and drop
bool acceptDrops() const;
void setAcceptDrops(bool on);
#ifndef QT_NO_ACTION
//actions
void addAction(QAction *action);
void addActions(QList<QAction*> actions);
void insertAction(QAction *before, QAction *action);
void insertActions(QAction *before, QList<QAction*> actions);
void removeAction(QAction *action);
QList<QAction*> actions() const;
#endif
QWidget *parentWidget() const;
void setWindowFlags(Qt::WindowFlags type);
Qt::WindowFlags windowFlags() const;
void overrideWindowFlags(Qt::WindowFlags type);
Qt::WindowType windowType() const;
static QWidget *find(WId);
QWidget *childAt(int x, int y) const;
QWidget *childAt(const QPoint &p) const;
#if defined(Q_WS_X11)
const QX11Info &x11Info() const;
Qt::HANDLE x11PictureHandle() const;
#endif
Qt::HANDLE handle() const;
void setAttribute(Qt::WidgetAttribute, bool on = true);
bool testAttribute(Qt::WidgetAttribute) const;
QPaintEngine *paintEngine() const;
void ensurePolished() const;
bool isAncestorOf(const QWidget *child) const;
#ifdef QT_KEYPAD_NAVIGATION
bool hasEditFocus() const;
void setEditFocus(bool on);
#endif
bool autoFillBackground() const;
void setAutoFillBackground(bool enabled);
void setWindowSurface(QWindowSurface *surface);
QWindowSurface *windowSurface() const;
Q_SIGNALS:
void customContextMenuRequested(const QPoint &pos);
protected:
// Event handlers
bool event(QEvent *);
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *);
#endif
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *);
virtual void focusInEvent(QFocusEvent *);
virtual void focusOutEvent(QFocusEvent *);
virtual void enterEvent(QEvent *);
virtual void leaveEvent(QEvent *);
virtual void paintEvent(QPaintEvent *);
virtual void moveEvent(QMoveEvent *);
virtual void resizeEvent(QResizeEvent *);
virtual void closeEvent(QCloseEvent *);
#ifndef QT_NO_CONTEXTMENU
virtual void contextMenuEvent(QContextMenuEvent *);
#endif
#ifndef QT_NO_ACTION
virtual void actionEvent(QActionEvent *);
#endif
#ifndef QT_NO_DRAGANDDROP
virtual void dragEnterEvent(QDragEnterEvent *);
virtual void dragMoveEvent(QDragMoveEvent *);
virtual void dragLeaveEvent(QDragLeaveEvent *);
virtual void dropEvent(QDropEvent *);
#endif
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
#if defined(Q_WS_X11)
virtual bool x11Event(XEvent *);
#endif
// Misc. protected functions
virtual void changeEvent(QEvent *);
int metric(PaintDeviceMetric) const;
protected Q_SLOTS:
void updateMicroFocus();
protected:
void create(WId = 0, bool initializeWindow = true,
bool destroyOldWindow = true);
void destroy(bool destroyWindow = true,
bool destroySubWindows = true);
virtual bool focusNextPrevChild(bool next);
bool focusNextChild();
bool focusPreviousChild();
QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f);
virtual void styleChange(QStyle&); // compat
virtual void enabledChange(bool); // compat
virtual void paletteChange(const QPalette &); // compat
virtual void fontChange(const QFont &); // compat
virtual void windowActivationChange(bool); // compat
virtual void languageChange(); // compat
};
template <> QWidget *qobject_cast<QWidget*>(QObject *o);
template <> const QWidget *qobject_cast<const QWidget*>(const QObject *o);

9
bindings/test.py Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/python2
import sys, KtCore, KtGui
a = KtGui.QApplication(0, None)
w = KtGui.QMainWindow()
w.setWindowTitle(KtCore.QString('Test'))
w.show()
sys.exit(a._exec())

19
bindings/tricks.i Normal file
View file

@ -0,0 +1,19 @@
#include "QtCore/qglobal.h"
/* ASCII interface is needed and macro uses are purged anyway
#define QT_ASCII_CAST_WARN
#define QT_ASCII_CAST_WARN_CONSTRUCTOR
*/
#define Q_GADGET
#define Q_ENUMS(x)
#define Q_NO_USING_KEYWORD
#define Q_REQUIRED_RESULT
#define QT_FASTCALL
#define Q_OBJECT
#define Q_PROPERTY(x)
#define QDOC_PROPERTY(x)
#define Q_SLOTS
#define Q_SIGNALS protected
#define Q_INVOKABLE