PythonQtWrapper_QTextObjectInterface.cpp
62 lines
| 2.4 KiB
| text/x-c
|
CppLexer
florianlink
|
r13 | #include "PythonQtWrapper_QTextObjectInterface.h" | ||
florianlink
|
r24 | #include <PythonQtSignalReceiver.h> | ||
#include <PythonQtMethodInfo.h> | ||||
#include <PythonQtConversion.h> | ||||
florianlink
|
r13 | #include <QVariant> | ||
#include <qpainter.h> | ||||
#include <qrect.h> | ||||
#include <qsize.h> | ||||
#include <qtextdocument.h> | ||||
#include <qtextformat.h> | ||||
florianlink
|
r24 | void PythonQtShell_QTextObjectInterface::drawObject(QPainter* painter, const QRectF& rect, QTextDocument* doc, int posInDocument, const QTextFormat& format) | ||
florianlink
|
r13 | { | ||
florianlink
|
r24 | if (_wrapper) { | ||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "drawObject"); | ||||
PyErr_Clear(); | ||||
if (obj && !PythonQtSlotFunction_Check(obj)) { | ||||
florianlink
|
r73 | static const char* argumentList[] ={"" , "QPainter*" , "const QRectF&" , "QTextDocument*" , "int" , "const QTextFormat&"}; | ||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(6, argumentList); | ||||
florianlink
|
r24 | void* args[6] = {NULL, (void*)&painter, (void*)&rect, (void*)&doc, (void*)&posInDocument, (void*)&format}; | ||
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | ||||
if (result) { Py_DECREF(result); } | ||||
Py_DECREF(obj); | ||||
return; | ||||
} | ||||
florianlink
|
r13 | } | ||
florianlink
|
r24 | |||
} | ||||
QSizeF PythonQtShell_QTextObjectInterface::intrinsicSize(QTextDocument* doc, int posInDocument, const QTextFormat& format) | ||||
florianlink
|
r13 | { | ||
florianlink
|
r24 | if (_wrapper) { | ||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "intrinsicSize"); | ||||
PyErr_Clear(); | ||||
if (obj && !PythonQtSlotFunction_Check(obj)) { | ||||
florianlink
|
r73 | static const char* argumentList[] ={"QSizeF" , "QTextDocument*" , "int" , "const QTextFormat&"}; | ||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(4, argumentList); | ||||
QSizeF returnValue; | ||||
florianlink
|
r24 | void* args[4] = {NULL, (void*)&doc, (void*)&posInDocument, (void*)&format}; | ||
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("intrinsicSize", methodInfo, result); | ||||
} else { | ||||
returnValue = *((QSizeF*)args[0]); | ||||
} | ||||
florianlink
|
r24 | } | ||
} | ||||
if (result) { Py_DECREF(result); } | ||||
Py_DECREF(obj); | ||||
return returnValue; | ||||
} | ||||
} | ||||
florianlink
|
r73 | QSizeF result; | ||
florianlink
|
r24 | return result; | ||
florianlink
|
r13 | } | ||
florianlink
|
r24 | QTextObjectInterface* PythonQtWrapper_QTextObjectInterface::new_QTextObjectInterface() | ||
{ | ||||
return new PythonQtShell_QTextObjectInterface(); } | ||||
florianlink
|
r13 | |||