Add QtUiTools bindings

This commit is contained in:
David Sansome 2011-05-15 16:12:38 +00:00
parent 8467bed946
commit 25e63e4b42
7 changed files with 427 additions and 2 deletions

View File

@ -25,6 +25,8 @@ set(SOURCES
generated_cpp/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
generated_cpp/com_trolltech_qt_network/com_trolltech_qt_network1.cpp
generated_cpp/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
generated_cpp/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
generated_cpp/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
src/gui/PythonQtScriptingConsole.cpp
src/PythonQtClassInfo.cpp
src/PythonQtClassWrapper.cpp
@ -61,6 +63,7 @@ set(HEADERS
generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
generated_cpp/com_trolltech_qt_network/com_trolltech_qt_network0.h
generated_cpp/com_trolltech_qt_network/com_trolltech_qt_network1.h
generated_cpp/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
src/gui/PythonQtScriptingConsole.h
src/PythonQt.h
src/PythonQtSignalReceiver.h

View File

@ -0,0 +1,332 @@
#include "com_trolltech_qt_uitools0.h"
#include <PythonQtConversion.h>
#include <PythonQtMethodInfo.h>
#include <PythonQtSignalReceiver.h>
#include <QVariant>
#include <qaction.h>
#include <qactiongroup.h>
#include <qbytearray.h>
#include <qcoreevent.h>
#include <qdir.h>
#include <qiodevice.h>
#include <qlayout.h>
#include <qlist.h>
#include <qobject.h>
#include <qstringlist.h>
#include <quiloader.h>
#include <qwidget.h>
void PythonQtShell_QUiLoader::childEvent(QChildEvent* arg__1)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "childEvent");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"" , "QChildEvent*"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList);
void* args[2] = {NULL, (void*)&arg__1};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return;
}
}
QUiLoader::childEvent(arg__1);
}
QAction* PythonQtShell_QUiLoader::createAction(QObject* parent, const QString& name)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "createAction");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"QAction*" , "QObject*" , "const QString&"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(3, argumentList);
QAction* returnValue;
void* args[3] = {NULL, (void*)&parent, (void*)&name};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) {
args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue);
if (args[0]!=&returnValue) {
if (args[0]==NULL) {
PythonQt::priv()->handleVirtualOverloadReturnError("createAction", methodInfo, result);
} else {
returnValue = *((QAction**)args[0]);
}
}
}
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return returnValue;
}
}
return QUiLoader::createAction(parent, name);
}
QActionGroup* PythonQtShell_QUiLoader::createActionGroup(QObject* parent, const QString& name)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "createActionGroup");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"QActionGroup*" , "QObject*" , "const QString&"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(3, argumentList);
QActionGroup* returnValue;
void* args[3] = {NULL, (void*)&parent, (void*)&name};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) {
args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue);
if (args[0]!=&returnValue) {
if (args[0]==NULL) {
PythonQt::priv()->handleVirtualOverloadReturnError("createActionGroup", methodInfo, result);
} else {
returnValue = *((QActionGroup**)args[0]);
}
}
}
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return returnValue;
}
}
return QUiLoader::createActionGroup(parent, name);
}
QLayout* PythonQtShell_QUiLoader::createLayout(const QString& className, QObject* parent, const QString& name)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "createLayout");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"QLayout*" , "const QString&" , "QObject*" , "const QString&"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(4, argumentList);
QLayout* returnValue;
void* args[4] = {NULL, (void*)&className, (void*)&parent, (void*)&name};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) {
args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue);
if (args[0]!=&returnValue) {
if (args[0]==NULL) {
PythonQt::priv()->handleVirtualOverloadReturnError("createLayout", methodInfo, result);
} else {
returnValue = *((QLayout**)args[0]);
}
}
}
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return returnValue;
}
}
return QUiLoader::createLayout(className, parent, name);
}
QWidget* PythonQtShell_QUiLoader::createWidget(const QString& className, QWidget* parent, const QString& name)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "createWidget");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"QWidget*" , "const QString&" , "QWidget*" , "const QString&"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(4, argumentList);
QWidget* returnValue;
void* args[4] = {NULL, (void*)&className, (void*)&parent, (void*)&name};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) {
args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue);
if (args[0]!=&returnValue) {
if (args[0]==NULL) {
PythonQt::priv()->handleVirtualOverloadReturnError("createWidget", methodInfo, result);
} else {
returnValue = *((QWidget**)args[0]);
}
}
}
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return returnValue;
}
}
return QUiLoader::createWidget(className, parent, name);
}
void PythonQtShell_QUiLoader::customEvent(QEvent* arg__1)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "customEvent");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"" , "QEvent*"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList);
void* args[2] = {NULL, (void*)&arg__1};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return;
}
}
QUiLoader::customEvent(arg__1);
}
bool PythonQtShell_QUiLoader::event(QEvent* arg__1)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "event");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"bool" , "QEvent*"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList);
bool returnValue;
void* args[2] = {NULL, (void*)&arg__1};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) {
args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue);
if (args[0]!=&returnValue) {
if (args[0]==NULL) {
PythonQt::priv()->handleVirtualOverloadReturnError("event", methodInfo, result);
} else {
returnValue = *((bool*)args[0]);
}
}
}
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return returnValue;
}
}
return QUiLoader::event(arg__1);
}
bool PythonQtShell_QUiLoader::eventFilter(QObject* arg__1, QEvent* arg__2)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "eventFilter");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"bool" , "QObject*" , "QEvent*"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(3, argumentList);
bool returnValue;
void* args[3] = {NULL, (void*)&arg__1, (void*)&arg__2};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) {
args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue);
if (args[0]!=&returnValue) {
if (args[0]==NULL) {
PythonQt::priv()->handleVirtualOverloadReturnError("eventFilter", methodInfo, result);
} else {
returnValue = *((bool*)args[0]);
}
}
}
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return returnValue;
}
}
return QUiLoader::eventFilter(arg__1, arg__2);
}
void PythonQtShell_QUiLoader::timerEvent(QTimerEvent* arg__1)
{
if (_wrapper) {
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "timerEvent");
PyErr_Clear();
if (obj && !PythonQtSlotFunction_Check(obj)) {
static const char* argumentList[] ={"" , "QTimerEvent*"};
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList);
void* args[2] = {NULL, (void*)&arg__1};
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
if (result) { Py_DECREF(result); }
Py_DECREF(obj);
return;
}
}
QUiLoader::timerEvent(arg__1);
}
QUiLoader* PythonQtWrapper_QUiLoader::new_QUiLoader(QObject* parent)
{
return new PythonQtShell_QUiLoader(parent); }
void PythonQtWrapper_QUiLoader::addPluginPath(QUiLoader* theWrappedObject, const QString& path)
{
( theWrappedObject->addPluginPath(path));
}
QStringList PythonQtWrapper_QUiLoader::availableLayouts(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->availableLayouts());
}
QStringList PythonQtWrapper_QUiLoader::availableWidgets(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->availableWidgets());
}
void PythonQtWrapper_QUiLoader::clearPluginPaths(QUiLoader* theWrappedObject)
{
( theWrappedObject->clearPluginPaths());
}
QAction* PythonQtWrapper_QUiLoader::createAction(QUiLoader* theWrappedObject, QObject* parent, const QString& name)
{
return ( ((PythonQtPublicPromoter_QUiLoader*)theWrappedObject)->promoted_createAction(parent, name));
}
QActionGroup* PythonQtWrapper_QUiLoader::createActionGroup(QUiLoader* theWrappedObject, QObject* parent, const QString& name)
{
return ( ((PythonQtPublicPromoter_QUiLoader*)theWrappedObject)->promoted_createActionGroup(parent, name));
}
QLayout* PythonQtWrapper_QUiLoader::createLayout(QUiLoader* theWrappedObject, const QString& className, QObject* parent, const QString& name)
{
return ( ((PythonQtPublicPromoter_QUiLoader*)theWrappedObject)->promoted_createLayout(className, parent, name));
}
QWidget* PythonQtWrapper_QUiLoader::createWidget(QUiLoader* theWrappedObject, const QString& className, QWidget* parent, const QString& name)
{
return ( ((PythonQtPublicPromoter_QUiLoader*)theWrappedObject)->promoted_createWidget(className, parent, name));
}
bool PythonQtWrapper_QUiLoader::isLanguageChangeEnabled(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->isLanguageChangeEnabled());
}
bool PythonQtWrapper_QUiLoader::isScriptingEnabled(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->isScriptingEnabled());
}
bool PythonQtWrapper_QUiLoader::isTranslationEnabled(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->isTranslationEnabled());
}
QWidget* PythonQtWrapper_QUiLoader::load(QUiLoader* theWrappedObject, QIODevice* device, QWidget* parentWidget)
{
return ( theWrappedObject->load(device, parentWidget));
}
QStringList PythonQtWrapper_QUiLoader::pluginPaths(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->pluginPaths());
}
void PythonQtWrapper_QUiLoader::setLanguageChangeEnabled(QUiLoader* theWrappedObject, bool enabled)
{
( theWrappedObject->setLanguageChangeEnabled(enabled));
}
void PythonQtWrapper_QUiLoader::setScriptingEnabled(QUiLoader* theWrappedObject, bool enabled)
{
( theWrappedObject->setScriptingEnabled(enabled));
}
void PythonQtWrapper_QUiLoader::setTranslationEnabled(QUiLoader* theWrappedObject, bool enabled)
{
( theWrappedObject->setTranslationEnabled(enabled));
}
void PythonQtWrapper_QUiLoader::setWorkingDirectory(QUiLoader* theWrappedObject, const QDir& dir)
{
( theWrappedObject->setWorkingDirectory(dir));
}
QDir PythonQtWrapper_QUiLoader::workingDirectory(QUiLoader* theWrappedObject) const
{
return ( theWrappedObject->workingDirectory());
}

View File

@ -0,0 +1,71 @@
#include <PythonQt.h>
#include <QObject>
#include <QVariant>
#include <qaction.h>
#include <qactiongroup.h>
#include <qbytearray.h>
#include <qcoreevent.h>
#include <qdir.h>
#include <qiodevice.h>
#include <qlayout.h>
#include <qlist.h>
#include <qobject.h>
#include <qstringlist.h>
#include <quiloader.h>
#include <qwidget.h>
class PythonQtShell_QUiLoader : public QUiLoader
{
public:
PythonQtShell_QUiLoader(QObject* parent = 0):QUiLoader(parent),_wrapper(NULL) {};
virtual void childEvent(QChildEvent* arg__1);
virtual QAction* createAction(QObject* parent = 0, const QString& name = QString());
virtual QActionGroup* createActionGroup(QObject* parent = 0, const QString& name = QString());
virtual QLayout* createLayout(const QString& className, QObject* parent = 0, const QString& name = QString());
virtual QWidget* createWidget(const QString& className, QWidget* parent = 0, const QString& name = QString());
virtual void customEvent(QEvent* arg__1);
virtual bool event(QEvent* arg__1);
virtual bool eventFilter(QObject* arg__1, QEvent* arg__2);
virtual void timerEvent(QTimerEvent* arg__1);
PythonQtInstanceWrapper* _wrapper;
};
class PythonQtPublicPromoter_QUiLoader : public QUiLoader
{ public:
inline QAction* promoted_createAction(QObject* parent = 0, const QString& name = QString()) { return QUiLoader::createAction(parent, name); }
inline QActionGroup* promoted_createActionGroup(QObject* parent = 0, const QString& name = QString()) { return QUiLoader::createActionGroup(parent, name); }
inline QLayout* promoted_createLayout(const QString& className, QObject* parent = 0, const QString& name = QString()) { return QUiLoader::createLayout(className, parent, name); }
inline QWidget* promoted_createWidget(const QString& className, QWidget* parent = 0, const QString& name = QString()) { return QUiLoader::createWidget(className, parent, name); }
};
class PythonQtWrapper_QUiLoader : public QObject
{ Q_OBJECT
public:
public slots:
QUiLoader* new_QUiLoader(QObject* parent = 0);
void delete_QUiLoader(QUiLoader* obj) { delete obj; }
void addPluginPath(QUiLoader* theWrappedObject, const QString& path);
QStringList availableLayouts(QUiLoader* theWrappedObject) const;
QStringList availableWidgets(QUiLoader* theWrappedObject) const;
void clearPluginPaths(QUiLoader* theWrappedObject);
QAction* createAction(QUiLoader* theWrappedObject, QObject* parent = 0, const QString& name = QString());
QActionGroup* createActionGroup(QUiLoader* theWrappedObject, QObject* parent = 0, const QString& name = QString());
QLayout* createLayout(QUiLoader* theWrappedObject, const QString& className, QObject* parent = 0, const QString& name = QString());
QWidget* createWidget(QUiLoader* theWrappedObject, const QString& className, QWidget* parent = 0, const QString& name = QString());
bool isLanguageChangeEnabled(QUiLoader* theWrappedObject) const;
bool isScriptingEnabled(QUiLoader* theWrappedObject) const;
bool isTranslationEnabled(QUiLoader* theWrappedObject) const;
QWidget* load(QUiLoader* theWrappedObject, QIODevice* device, QWidget* parentWidget = 0);
QStringList pluginPaths(QUiLoader* theWrappedObject) const;
void setLanguageChangeEnabled(QUiLoader* theWrappedObject, bool enabled);
void setScriptingEnabled(QUiLoader* theWrappedObject, bool enabled);
void setTranslationEnabled(QUiLoader* theWrappedObject, bool enabled);
void setWorkingDirectory(QUiLoader* theWrappedObject, const QDir& dir);
QDir workingDirectory(QUiLoader* theWrappedObject) const;
};

View File

@ -0,0 +1,9 @@
#include <PythonQt.h>
#include "com_trolltech_qt_uitools0.h"
#include "com_trolltech_qt_uitools_init.h"
void PythonQt_init_QtUiTools(PyObject* module) {
PythonQt::priv()->registerClass(&QUiLoader::staticMetaObject, "QtUiTools", PythonQtCreateObject<PythonQtWrapper_QUiLoader>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_QUiLoader>, module, 0);
}

View File

@ -0,0 +1,8 @@
#ifndef COM_TROLLTECH_QT_UITOOLS_INIT_H
#define COM_TROLLTECH_QT_UITOOLS_INIT_H
#include "PythonQtSystem.h"
PYTHONQT_EXPORT void PythonQt_init_QtUiTools(PyObject* module);
#endif // COM_TROLLTECH_QT_UITOOLS_INIT_H

View File

@ -13,7 +13,7 @@ if (UNIX AND NOT APPLE)
set(LINUX 1)
endif (UNIX AND NOT APPLE)
find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml)
find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml QtUiTools)
if (LINUX)
option(ENABLE_DBUS "Enable D-Bus, MPRIS and native notifications. Required for DeviceKit and Wii remote support" ON)
if(ENABLE_DBUS)

View File

@ -19,6 +19,7 @@
#include <com_trolltech_qt_core/com_trolltech_qt_core_init.h>
#include <com_trolltech_qt_gui/com_trolltech_qt_gui_init.h>
#include <com_trolltech_qt_network/com_trolltech_qt_network_init.h>
#include <com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.h>
#include "pythonengine.h"
#include "pythonscript.h"
@ -78,7 +79,7 @@ bool PythonEngine::EnsureInitialised() {
PythonQt_init_QtCore(0);
PythonQt_init_QtGui(0);
PythonQt_init_QtNetwork(0);
PythonQt_init_Clementine(0);
PythonQt_init_QtUiTools(0);
PythonQt* python_qt = PythonQt::self();
python_qt->installDefaultImporter();
@ -88,6 +89,7 @@ bool PythonEngine::EnsureInitialised() {
// Create a clementine module
clementine_module_ = python_qt->createModuleFromScript(kClementineModuleName);
PythonQt_init_Clementine(clementine_module_);
// Add classes
python_qt->registerClass(&AutoExpandingTreeView::staticMetaObject, kClementineModuleName);