PythonQtWrapper_QUndoCommand.cpp
146 lines
| 4.8 KiB
| text/x-c
|
CppLexer
florianlink
|
r13 | #include "PythonQtWrapper_QUndoCommand.h" | ||
florianlink
|
r24 | #include <PythonQtSignalReceiver.h> | ||
#include <PythonQtMethodInfo.h> | ||||
#include <PythonQtConversion.h> | ||||
florianlink
|
r13 | #include <QVariant> | ||
#include <qundostack.h> | ||||
florianlink
|
r24 | int PythonQtShell_QUndoCommand::id() const | ||
{ | ||||
if (_wrapper) { | ||||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "id"); | ||||
PyErr_Clear(); | ||||
if (obj && !PythonQtSlotFunction_Check(obj)) { | ||||
florianlink
|
r73 | static const char* argumentList[] ={"int"}; | ||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | ||||
int returnValue; | ||||
florianlink
|
r24 | void* args[1] = {NULL}; | ||
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) { | ||||
florianlink
|
r73 | if (args[0]==NULL) { | ||
PythonQt::priv()->handleVirtualOverloadReturnError("id", methodInfo, result); | ||||
} else { | ||||
returnValue = *((int*)args[0]); | ||||
} | ||||
florianlink
|
r24 | } | ||
} | ||||
if (result) { Py_DECREF(result); } | ||||
Py_DECREF(obj); | ||||
return returnValue; | ||||
} | ||||
} | ||||
return QUndoCommand::id(); | ||||
} | ||||
bool PythonQtShell_QUndoCommand::mergeWith(const QUndoCommand* other) | ||||
{ | ||||
if (_wrapper) { | ||||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "mergeWith"); | ||||
PyErr_Clear(); | ||||
if (obj && !PythonQtSlotFunction_Check(obj)) { | ||||
florianlink
|
r73 | static const char* argumentList[] ={"bool" , "const QUndoCommand*"}; | ||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList); | ||||
bool returnValue; | ||||
florianlink
|
r24 | void* args[2] = {NULL, (void*)&other}; | ||
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) { | ||||
florianlink
|
r73 | if (args[0]==NULL) { | ||
PythonQt::priv()->handleVirtualOverloadReturnError("mergeWith", methodInfo, result); | ||||
} else { | ||||
returnValue = *((bool*)args[0]); | ||||
} | ||||
florianlink
|
r24 | } | ||
} | ||||
if (result) { Py_DECREF(result); } | ||||
Py_DECREF(obj); | ||||
return returnValue; | ||||
} | ||||
} | ||||
return QUndoCommand::mergeWith(other); | ||||
} | ||||
void PythonQtShell_QUndoCommand::redo() | ||||
{ | ||||
if (_wrapper) { | ||||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "redo"); | ||||
PyErr_Clear(); | ||||
if (obj && !PythonQtSlotFunction_Check(obj)) { | ||||
florianlink
|
r73 | static const char* argumentList[] ={""}; | ||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | ||||
florianlink
|
r24 | void* args[1] = {NULL}; | ||
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | ||||
if (result) { Py_DECREF(result); } | ||||
Py_DECREF(obj); | ||||
return; | ||||
} | ||||
} | ||||
QUndoCommand::redo(); | ||||
} | ||||
void PythonQtShell_QUndoCommand::undo() | ||||
{ | ||||
if (_wrapper) { | ||||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "undo"); | ||||
PyErr_Clear(); | ||||
if (obj && !PythonQtSlotFunction_Check(obj)) { | ||||
florianlink
|
r73 | static const char* argumentList[] ={""}; | ||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | ||||
florianlink
|
r24 | void* args[1] = {NULL}; | ||
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | ||||
if (result) { Py_DECREF(result); } | ||||
Py_DECREF(obj); | ||||
return; | ||||
} | ||||
} | ||||
QUndoCommand::undo(); | ||||
} | ||||
florianlink
|
r13 | QUndoCommand* PythonQtWrapper_QUndoCommand::new_QUndoCommand(QUndoCommand* parent) | ||
{ | ||||
florianlink
|
r24 | return new PythonQtShell_QUndoCommand(parent); } | ||
florianlink
|
r13 | |||
QUndoCommand* PythonQtWrapper_QUndoCommand::new_QUndoCommand(const QString& text, QUndoCommand* parent) | ||||
{ | ||||
florianlink
|
r24 | return new PythonQtShell_QUndoCommand(text, parent); } | ||
florianlink
|
r13 | |||
florianlink
|
r24 | void PythonQtWrapper_QUndoCommand::setText(QUndoCommand* theWrappedObject, const QString& text) | ||
florianlink
|
r13 | { | ||
florianlink
|
r73 | ( theWrappedObject->setText(text)); | ||
florianlink
|
r13 | } | ||
florianlink
|
r24 | QString PythonQtWrapper_QUndoCommand::text(QUndoCommand* theWrappedObject) const | ||
florianlink
|
r13 | { | ||
florianlink
|
r73 | return ( theWrappedObject->text()); | ||
florianlink
|
r13 | } | ||
florianlink
|
r28 | bool PythonQtWrapper_QUndoCommand::mergeWith(QUndoCommand* theWrappedObject, const QUndoCommand* other) | ||
florianlink
|
r13 | { | ||
florianlink
|
r73 | return ( ((PythonQtPublicPromoter_QUndoCommand*)theWrappedObject)->promoted_mergeWith(other)); | ||
florianlink
|
r13 | } | ||
florianlink
|
r28 | void PythonQtWrapper_QUndoCommand::redo(QUndoCommand* theWrappedObject) | ||
florianlink
|
r13 | { | ||
florianlink
|
r73 | ( ((PythonQtPublicPromoter_QUndoCommand*)theWrappedObject)->promoted_redo()); | ||
florianlink
|
r13 | } | ||
florianlink
|
r28 | const QUndoCommand* PythonQtWrapper_QUndoCommand::child(QUndoCommand* theWrappedObject, int index) const | ||
florianlink
|
r13 | { | ||
florianlink
|
r73 | return ( theWrappedObject->child(index)); | ||
florianlink
|
r13 | } | ||
florianlink
|
r24 | int PythonQtWrapper_QUndoCommand::childCount(QUndoCommand* theWrappedObject) const | ||
florianlink
|
r13 | { | ||
florianlink
|
r73 | return ( theWrappedObject->childCount()); | ||
florianlink
|
r28 | } | ||
int PythonQtWrapper_QUndoCommand::id(QUndoCommand* theWrappedObject) const | ||||
{ | ||||
florianlink
|
r73 | return ( ((PythonQtPublicPromoter_QUndoCommand*)theWrappedObject)->promoted_id()); | ||
} | ||||
void PythonQtWrapper_QUndoCommand::undo(QUndoCommand* theWrappedObject) | ||||
{ | ||||
( ((PythonQtPublicPromoter_QUndoCommand*)theWrappedObject)->promoted_undo()); | ||||
florianlink
|
r13 | } | ||