From 544aa98d116ba812bb745bd5b2bebaa0e75fd83c 2009-05-26 13:27:45 From: florianlink Date: 2009-05-26 13:27:45 Subject: [PATCH] added QObject tr decorator git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@104 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/src/PythonQtStdDecorators.cpp b/src/PythonQtStdDecorators.cpp index d604613..3a92abc 100644 --- a/src/PythonQtStdDecorators.cpp +++ b/src/PythonQtStdDecorators.cpp @@ -42,7 +42,7 @@ #include "PythonQtStdDecorators.h" #include "PythonQt.h" #include "PythonQtClassInfo.h" - +#include bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, PyObject* callable) { @@ -153,3 +153,9 @@ QVariantList PythonQtStdDecorators::children(QObject* o) } return v; } + +QString PythonQtStdDecorators::tr(QObject* obj, const QByteArray& text, const QByteArray& ambig, int n) +{ + return QCoreApplication::translate(obj->metaObject()->className(), text.constData(), ambig.constData(), QCoreApplication::CodecForTr, n); +} + diff --git a/src/PythonQtStdDecorators.h b/src/PythonQtStdDecorators.h index 505bd91..1fde33a 100644 --- a/src/PythonQtStdDecorators.h +++ b/src/PythonQtStdDecorators.h @@ -91,6 +91,8 @@ public slots: int static_Qt_qrand() { return qrand(); } void static_Qt_qsrand(uint a) { qsrand(a); } + QString tr(QObject* obj, const QByteArray& text, const QByteArray& text = QByteArray(), int n = -1); + QByteArray static_Qt_SIGNAL(const QByteArray& s) { return QByteArray("2") + s; } QByteArray static_Qt_SLOT(const QByteArray& s) { return QByteArray("1") + s; }