1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 04:19:55 +01:00

Add some PythonQt patches

This commit is contained in:
David Sansome 2011-05-30 18:56:48 +00:00
parent 57d7989623
commit a65dab7bad
4 changed files with 58677 additions and 0 deletions

View File

@ -0,0 +1,40 @@
commit 0e555968ea51ab125a070df10ed24ce0eb24ed2a
Author: davidsansome <davidsansome@94c5599e-fc6c-11de-b061-8119ef04aefe>
Date: Mon May 30 14:54:11 2011 +0000
Hack the wrapped ~QStandardItem to remove the row properly from the model (which deletes it as well)
git-svn-id: https://clementine-player.googlecode.com/svn/trunk@3345 94c5599e-fc6c-11de-b061-8119ef04aefe
diff --git a/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp b/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
index e08ea9b..16c24dc 100644
--- a/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
+++ b/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
@@ -1039,6 +1039,14 @@ QStandardItem* PythonQtWrapper_QStandardItem::new_QStandardItem(int rows, int
{
return new PythonQtShell_QStandardItem(rows, columns); }
+void PythonQtWrapper_QStandardItem::delete_QStandardItem(QStandardItem* obj) {
+ if (obj && obj->parent()) {
+ obj->parent()->removeRow(obj->row());
+ } else if (obj) {
+ delete obj;
+ }
+}
+
QString PythonQtWrapper_QStandardItem::accessibleDescription(QStandardItem* theWrappedObject) const
{
return ( theWrappedObject->accessibleDescription());
diff --git a/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.h b/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
index 23ff35d..380b7fc 100644
--- a/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
+++ b/3rdparty/pythonqt/generated_cpp/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
@@ -161,7 +161,7 @@ QStandardItem* new_QStandardItem();
QStandardItem* new_QStandardItem(const QIcon& icon, const QString& text);
QStandardItem* new_QStandardItem(const QString& text);
QStandardItem* new_QStandardItem(int rows, int columns = 1);
-void delete_QStandardItem(QStandardItem* obj) { delete obj; }
+void delete_QStandardItem(QStandardItem* obj);
QString accessibleDescription(QStandardItem* theWrappedObject) const;
QString accessibleText(QStandardItem* theWrappedObject) const;
void appendColumn(QStandardItem* theWrappedObject, const QList<QStandardItem* >& items);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
commit c06934993daab01ab831fa2478f1d11fb298afd5
Author: davidsansome <davidsansome@94c5599e-fc6c-11de-b061-8119ef04aefe>
Date: Mon May 30 14:53:59 2011 +0000
Remember any signals that are connected to Python objects and disconnect them when the script is unloaded so the references to those objects can be dropped
git-svn-id: https://clementine-player.googlecode.com/svn/trunk@3344 94c5599e-fc6c-11de-b061-8119ef04aefe
diff --git a/3rdparty/pythonqt/src/PythonQt.h b/3rdparty/pythonqt/src/PythonQt.h
index 050dadc..9a7c29f 100644
--- a/3rdparty/pythonqt/src/PythonQt.h
+++ b/3rdparty/pythonqt/src/PythonQt.h
@@ -453,6 +453,10 @@ signals:
//! emitted when help() is called on a PythonQt object and \c ExternalHelp is enabled
void pythonHelpRequest(const QByteArray& cppClassName);
+ //! emitted when a signal is connected to a Python object
+ void signalConnectedToPython(PythonQtSignalReceiver* receiver, int signal_id,
+ PyObject* callable);
+
private:
void initPythonQtModule(bool redirectStdOut, const QByteArray& pythonQtModuleName);
@@ -472,6 +476,7 @@ private:
PythonQtPrivate* _p;
+ friend class PythonQtSignalReceiver;
};
//! internal PythonQt details
diff --git a/3rdparty/pythonqt/src/PythonQtSignalReceiver.cpp b/3rdparty/pythonqt/src/PythonQtSignalReceiver.cpp
index d4074b1..7bb9dfc 100644
--- a/3rdparty/pythonqt/src/PythonQtSignalReceiver.cpp
+++ b/3rdparty/pythonqt/src/PythonQtSignalReceiver.cpp
@@ -170,22 +170,26 @@ bool PythonQtSignalReceiver::addSignalHandler(const char* signal, PyObject* call
_slotCount++;
flag = true;
+
+ PythonQt::self()->signalConnectedToPython(this, sigId, callable);
}
return flag;
}
bool PythonQtSignalReceiver::removeSignalHandler(const char* signal, PyObject* callable)
{
+ return removeSignalHandler(getSignalIndex(signal), callable);
+}
+
+bool PythonQtSignalReceiver::removeSignalHandler(int sigId, PyObject* callable)
+{
bool found = false;
- int sigId = getSignalIndex(signal);
- if (sigId>=0) {
- QMutableListIterator<PythonQtSignalTarget> i(_targets);
- while (i.hasNext()) {
- if (i.next().isSame(sigId, callable)) {
- i.remove();
- found = true;
- break;
- }
+ QMutableListIterator<PythonQtSignalTarget> i(_targets);
+ while (i.hasNext()) {
+ if (i.next().isSame(sigId, callable)) {
+ i.remove();
+ found = true;
+ break;
}
}
return found;
diff --git a/3rdparty/pythonqt/src/PythonQtSignalReceiver.h b/3rdparty/pythonqt/src/PythonQtSignalReceiver.h
index dfbcbc6..028b853 100644
--- a/3rdparty/pythonqt/src/PythonQtSignalReceiver.h
+++ b/3rdparty/pythonqt/src/PythonQtSignalReceiver.h
@@ -119,6 +119,7 @@ public:
//! remove a signal handler
bool removeSignalHandler(const char* signal, PyObject* callable);
+ bool removeSignalHandler(int sigId, PyObject* callable);
//! remove all signal handlers
void removeSignalHandlers();