1 #ifndef _PYTHONQTSTDDECORATORS_H
2 #define _PYTHONQTSTDDECORATORS_H
50 #include <QVariantList>
51 #include <QTextDocument>
58 #include <QMetaMethod>
60 #include <QMetaProperty>
61 #if QT_VERSION >= 0x060000
62 #include <QRandomGenerator>
71 bool connect(QObject* sender,
const QByteArray& signal, QObject* receiver,
const QByteArray& slot, Qt::ConnectionType type = Qt::AutoConnection);
72 bool connect(QObject* receiver, QObject* sender,
const QByteArray& signal,
const QByteArray& slot, Qt::ConnectionType type = Qt::AutoConnection) {
return connect(sender, signal, receiver, slot, type); }
74 bool static_QObject_connect(QObject* sender,
const QByteArray& signal, QObject* receiver,
const QByteArray& slot, Qt::ConnectionType type = Qt::AutoConnection) {
return connect(sender, signal, receiver, slot, type); }
76 bool disconnect(QObject* sender,
const QByteArray& signal, QObject* receiver,
const QByteArray& slot);
78 bool static_QObject_disconnect(QObject* sender,
const QByteArray& signal, QObject* receiver,
const QByteArray& slot) {
return disconnect(sender, signal, receiver, slot); }
90 bool setProperty(QObject* o,
const char* name,
const QVariant& value);
91 QVariant
property(QObject* o,
const char* name);
112 #if QT_VERSION < 0x060000
115 return QRandomGenerator::global()->generate();
121 #if QT_VERSION < 0x060000
124 QRandomGenerator::global()->seed(a);
128 QString
tr(QObject* obj,
const QString& text,
const QString& ambig = QString(),
int n = -1);
136 QObject* findChild(QObject* parent,
const char*
typeName,
const QMetaObject* meta,
const QString& name);
137 int findChildren(QObject* parent,
const char*
typeName,
const QMetaObject* meta,
const QString& name, QList<QObject*>& list);
138 int findChildren(QObject* parent,
const char*
typeName,
const QMetaObject* meta,
const QRegularExpression& regExp, QList<QObject*>& list);
161 const char *
getClassName(QMetaObject* obj)
const {
return obj->className(); }
162 const QMetaObject *
superClass(QMetaObject* obj)
const {
return obj->superClass(); }
164 int methodOffset(QMetaObject* obj)
const {
return obj->methodOffset(); }
170 int methodCount(QMetaObject* obj)
const {
return obj->methodCount(); }
177 int indexOfSignal(QMetaObject* obj,
const char *signal)
const {
return obj->indexOfSignal(signal); }
178 int indexOfSlot(QMetaObject* obj,
const char *slot)
const {
return obj->indexOfSlot(slot); }
179 int indexOfEnumerator(QMetaObject* obj,
const char *name)
const {
return obj->indexOfEnumerator(name); }
180 int indexOfProperty(QMetaObject* obj,
const char *name)
const {
return obj->indexOfProperty(name); }
181 int indexOfClassInfo(QMetaObject* obj,
const char *name)
const {
return obj->indexOfClassInfo(name); }
183 QMetaMethod
constructor(QMetaObject* obj,
int index)
const {
return obj->constructor(index); }
184 QMetaMethod
method(QMetaObject* obj,
int index)
const {
return obj->method(index); }
185 QMetaEnum
enumerator(QMetaObject* obj,
int index)
const {
return obj->enumerator(index); }
186 QMetaProperty
property(QMetaObject* obj,
int index)
const {
return obj->property(index); }
187 QMetaClassInfo
classInfo(QMetaObject* obj,
int index)
const {
return obj->classInfo(index); }
188 QMetaProperty
userProperty(QMetaObject* obj)
const {
return obj->userProperty(); }
Some methods to set properties of PythonQt from Python.
PythonQtConfigAPI(QObject *parent)
void setTaskDoneCallback(PyObject *object)
Some helper methods that allow testing of the ownership.
bool isDerivedShellInstance(PyObject *object)
Returns if the C++ object is an instance of a Python class that derives a C++ class.
bool isOwnedByPython(PyObject *object)
Returns if the C++ object is owned by PythonQt and will be deleted when the reference goes away.
PythonQtDebugAPI(QObject *parent)
bool isPythonQtClassWrapper(PyObject *object)
Returns if the given object is a PythonQt class wrapper (or derived class)
bool isPythonQtInstanceWrapper(PyObject *object)
Returns if the given object is a PythonQt instance wrapper (or derived class)
bool passOwnershipToPython(PyObject *object)
Pass the ownership of the given object to Python (so that the C++ object will be deleted when the Pyt...
bool passOwnershipToCPP(PyObject *object)
Pass the ownership of the given object to CPP (so that it will not be deleted by Python if the refere...
bool hasExtraShellRefCount(PyObject *object)
Returns if the shell instance has an extra ref count from the C++ side.
a smart pointer that stores a PyObject pointer and that handles reference counting automatically
PythonQtSingleShotTimer(int msec, const PythonQtObjectPtr &callable)
~PythonQtSingleShotTimer() override
double static_Qt_qMin(double a, double b)
void static_Qt_qDebug(const QByteArray &msg)
double static_Qt_qMax(double a, double b)
bool connect(QObject *receiver, QObject *sender, const QByteArray &signal, const QByteArray &slot, Qt::ConnectionType type=Qt::AutoConnection)
void static_QTimer_singleShot(int msec, PyObject *callable)
void static_Qt_qCritical(const QByteArray &msg)
double static_Qt_qAbs(double a)
int static_Qt_qRound(double a)
QObject * parent(QObject *o)
bool static_QObject_disconnect(QObject *sender, const QByteArray &signal, PyObject *callable=nullptr)
void static_Qt_qWarning(const QByteArray &msg)
QObject * findChild(QObject *parent, PyObject *type, const QString &name=QString())
const QMetaObject * metaObject(QObject *obj)
QString tr(QObject *obj, const QString &text, const QString &ambig=QString(), int n=-1)
QString static_Qt_SIGNAL(const QString &s)
bool connect(QObject *sender, const QByteArray &signal, PyObject *callable)
const char * static_Qt_qVersion()
bool static_QObject_disconnect(QObject *sender, const QByteArray &signal, QObject *receiver, const QByteArray &slot)
QString static_Qt_SLOT(const QString &s)
void static_Qt_qFatal(const QByteArray &msg)
double static_Qt_qBound(double a, double b, double c)
qint64 static_Qt_qRound64(double a)
bool static_QObject_connect(QObject *sender, const QByteArray &signal, QObject *receiver, const QByteArray &slot, Qt::ConnectionType type=Qt::AutoConnection)
void setParent(QObject *o, PythonQtNewOwnerOfThis< QObject * > parent)
bool static_Qt_qFuzzyCompare(double a, double b)
bool static_QObject_connect(QObject *sender, const QByteArray &signal, PyObject *callable)
void static_Qt_qsrand(uint a)
bool disconnect(QObject *sender, const QByteArray &signal, QObject *receiver, const QByteArray &slot)
const QObjectList * children(QObject *o)
bool disconnect(QObject *sender, const QByteArray &signal, PyObject *callable=nullptr)
QList< QObject * > findChildren(QObject *parent, PyObject *type, const QString &name=QString())
QList< QObject * > findChildren(QObject *parent, PyObject *type, const QRegularExpression ®Exp)
bool connect(QObject *sender, const QByteArray &signal, QObject *receiver, const QByteArray &slot, Qt::ConnectionType type=Qt::AutoConnection)
QVariant property(QObject *o, const char *name)
bool setProperty(QObject *o, const char *name, const QVariant &value)
QByteArray typeName(const QMetaMethod &method)