<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pyside6 Slot with Name arg crashes app]]></title><description><![CDATA[<p dir="auto">I use Pyside6 with QML and when calling the method "testMethod()" in QML using a button to call it, the app crashes with no error messages, just an instant close. But calling "test_method2()" in QML does no cause a crash and works fine.<br />
As I know creating a signal on the class QObject like this this_sig = Signal(name="thisSig") works completely fine, so I assumed that would be the case for a Slot as well.</p>
<p dir="auto">Is the "name" arg in Slot simply bugged or not how I interprit its used as?</p>
<pre><code>class Controller(QObject):
    def __init__(
        self,
        /,
        parent: QObject | None,
    ) -&gt; None:
        super().__init__(parent)

    @Slot(name="testMethod", result=None)
    def test_method(self) -&gt; None:
        print("test")

    @Slot(result=None)
    def test_method2(self) -&gt; None:
        print("test")
</code></pre>
<pre><code>Button {
text: "test"
onClicked: Controller.testMethod() // This crashes
}

Button {
text: "test2"
onClicked: Controller.test_method2() // This works
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/165036/pyside6-slot-with-name-arg-crashes-app</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 06:52:57 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165036.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Aug 2026 23:13:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pyside6 Slot with Name arg crashes app on Tue, 25 Aug 2026 19:26:14 GMT]]></title><description><![CDATA[<p dir="auto">That produces file:///../Example/Main.qml:11: TypeError: Property 'testMethod' of object Example/Controller is not a function - an instance of Controller is needed.</p>
]]></description><link>https://forum.qt.io/post/839856</link><guid isPermaLink="true">https://forum.qt.io/post/839856</guid><dc:creator><![CDATA[friedemannkleint]]></dc:creator><pubDate>Tue, 25 Aug 2026 19:26:14 GMT</pubDate></item><item><title><![CDATA[Reply to Pyside6 Slot with Name arg crashes app on Tue, 25 Aug 2026 18:34:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/friedemannkleint">@<bdi>friedemannkleint</bdi></a> Here is a complete minimal example that reproduces the issue.</p>
<p dir="auto"><strong>Python (<code>main.py</code>):</strong></p>
<pre><code class="language-python">import sys

from PySide6.QtCore import QObject, Slot
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine, QmlElement

QML_IMPORT_NAME = "Example"
QML_IMPORT_MAJOR_VERSION = 1


@QmlElement
class Controller(QObject):
    def __init__(
        self,
        /,
        parent: QObject | None = None,
    ) -&gt; None:
        super().__init__(parent)

    @Slot(name="testMethod", result=None)
    def test_method(self) -&gt; None:
        print("test")

    @Slot(result=None)
    def test_method2(self) -&gt; None:
        print("test")


def main() -&gt; None:
    app = QGuiApplication(sys.argv)

    engine = QQmlApplicationEngine()
    engine.loadFromModule("Example", "Main")

    if not engine.rootObjects():
        sys.exit(-1)

    sys.exit(app.exec())


if __name__ == "__main__":
    main()
</code></pre>
<p dir="auto"><strong>QML (<code>Main.qml</code>):</strong></p>
<pre><code class="language-qml">import QtQuick
import QtQuick.Controls
import Example

ApplicationWindow {
    visible: true

    Column {
        Button {
            text: "test"
            onClicked: Controller.testMethod()
        }

        Button {
            text: "test2"
            onClicked: Controller.test_method2()
        }
    }
}
</code></pre>
<p dir="auto">With this example, calling <code>Controller.testMethod()</code> causes the application to crash, while <code>Controller.test_method2()</code> works.</p>
<p dir="auto">The only difference between the two methods is that the first uses <code>@Slot(name="testMethod", result=None)</code> to expose the Python method under a different QML name.</p>
<p dir="auto">Python: 3.14.2<br />
PySide6: 6.11.2<br />
Qt: 6.11.2<br />
OS: Windows 11</p>
]]></description><link>https://forum.qt.io/post/839854</link><guid isPermaLink="true">https://forum.qt.io/post/839854</guid><dc:creator><![CDATA[Leooooooooo]]></dc:creator><pubDate>Tue, 25 Aug 2026 18:34:04 GMT</pubDate></item><item><title><![CDATA[Reply to Pyside6 Slot with Name arg crashes app on Tue, 25 Aug 2026 11:27:08 GMT]]></title><description><![CDATA[<p dir="auto">Can you please provide a complete, minimal example that reproduces the crash (or report it as a bug (see  <a href="https://wiki.qt.io/Qt_for_Python/Reporting_Bugs" target="_blank" rel="noopener noreferrer nofollow ugc">https://wiki.qt.io/Qt_for_Python/Reporting_Bugs</a> )?</p>
]]></description><link>https://forum.qt.io/post/839850</link><guid isPermaLink="true">https://forum.qt.io/post/839850</guid><dc:creator><![CDATA[friedemannkleint]]></dc:creator><pubDate>Tue, 25 Aug 2026 11:27:08 GMT</pubDate></item></channel></rss>