[education/labplot] src/backend/script/python: [scripting] filter out Qt/QObject internal methods that shouldn't be part of the public API

Alexander Semke <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 7da01eae0bf111253cbc5f5198c3eaaa4157ba66 by Alexander Semke.
Committed on 01/08/2026 at 20:22.
Pushed by asemke into branch 'master'.

[scripting] filter out Qt/QObject internal methods that shouldn't be part of the public API
shown in the completion box. For now, the user still will be able to call them, 
but they won't be suggested in the completion box. Later we'll need to decide if we want to
remove them from the public API completely by filtering them out in the shiboken binding generation.

M  +50   -0    src/backend/script/python/PythonScriptRuntime.cpp

https://invent.kde.org/education/labplot/-/commit/7da01eae0bf111253cbc5f5198c3eaaa4157ba66

diff --git a/src/backend/script/python/PythonScriptRuntime.cpp b/src/backend/script/python/PythonScriptRuntime.cpp
index b4cbeb740b..c4f9f2f1e3 100644
--- a/src/backend/script/python/PythonScriptRuntime.cpp
+++ b/src/backend/script/python/PythonScriptRuntime.cpp
@@ -958,6 +958,56 @@ QList<PylabplotMemberInfo> getPylabplotClassMembersHelper(const QString& classNa
 			if (name.isEmpty() || name.startsWith(QLatin1Char('_')))
 				continue; // Skip private/special methods
 
+			// Filter out Qt/QObject internal methods that shouldn't be part of the public API
+			// shown in the completion box. For now, the user still will be able to call them, 
+			// but they won't be suggested in the completion box.
+			// TODO: decide if we want to remove them from the public API completely, if possible,
+			// by filtering them out in the shiboken binding generation.
+			static const QStringList qtInternalMethods = {
+				QStringLiteral("connect"),
+				QStringLiteral("connectNotify"),
+				QStringLiteral("customEvent"),
+				QStringLiteral("deleteLater"),
+				QStringLiteral("disconnect"),
+				QStringLiteral("disconnectNotify"),
+				QStringLiteral("dumpObjectInfo"),
+				QStringLiteral("dumpObjectTree"),
+				QStringLiteral("dynamicPropertyNames"),
+				QStringLiteral("emit"),
+				QStringLiteral("event"),
+				QStringLiteral("eventFilter"),
+				QStringLiteral("findChild"),
+				QStringLiteral("findChildren"),
+				QStringLiteral("inherits"),
+				QStringLiteral("installEventFilter"),
+				QStringLiteral("isSignalConnected"),
+				QStringLiteral("isWidgetType"),
+				QStringLiteral("isWindowType"),
+				QStringLiteral("killTimer"),
+				QStringLiteral("metaObject"),
+				QStringLiteral("moveToThread"),
+				QStringLiteral("objectName"),
+				QStringLiteral("objectNameChanged"),
+				QStringLiteral("parent"),
+				QStringLiteral("property"),
+				QStringLiteral("receivers"),
+				QStringLiteral("removeEventFilter"),
+				QStringLiteral("sender"),
+				QStringLiteral("senderSignalIndex"),
+				QStringLiteral("setObjectName"),
+				QStringLiteral("setParent"),
+				QStringLiteral("setProperty"),
+				QStringLiteral("signalsBlocked"),
+				QStringLiteral("startTimer"),
+				QStringLiteral("thread"),
+				QStringLiteral("timerEvent"),
+				QStringLiteral("tr"),
+				QStringLiteral("destroyed"),
+			};
+
+			if (qtInternalMethods.contains(name))
+				continue; // Skip Qt internal methods
+
 			// Get the attribute object
 			QByteArray nameBytes = name.toUtf8();
 			PyObject* attr = PyObject_GetAttrString(classObj, nameBytes.constData());
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.