[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] SystemTrayIcon activated signal
From:       Kálmán Viktor <viktorvector () gmail ! com>
Date:       2017-08-23 14:34:36
Message-ID: CA+sJfQwNZOqk3Bas4MAp_3Kxfn63rWWTM3pOVfcm6U4d2Xp5bA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

I'm trying to connect a signal to SystemTrayIcon's activated.

The relevant part looks like this:
        self.qwindow.load(qml_url)
        first = self.qwindow.rootObjects()[0]
        tray = first.findChild(QObject, "anyadszerete")  # in the qml file
objectName is set

        @pyqtSlot(QObject, name="activated")
        def activated(reason):
            print(reason)

        tray.activated.connect(activated)

The error I get: TypeError: C++ type
'QPlatformSystemTrayIcon::ActivationReason' is not supported as a signal
argument type

What would be the correct way to do this?

Also I'm not entirely sure if this is PyQt related but the reason I'm
trying to do it this way (and not in my QtQuick QML file) is because
`onActivated: { console.log(reason); }` always prints undefined in the
app.qml (but im not sure if it's a Qt or PyQt issue)

[Attachment #5 (text/html)]

<div dir="ltr">Hello,<div><br></div><div>I&#39;m trying to connect a signal to \
SystemTrayIcon&#39;s activated.  </div><div><br></div><div>The relevant part looks \
like this:</div><div><div>            self.qwindow.load(qml_url)</div><div>           \
first = self.qwindow.rootObjects()[0]</div><div>            tray = \
first.findChild(QObject, &quot;anyadszerete&quot;)   # in the qml file objectName is \
set</div><div><br></div><div>            @pyqtSlot(QObject, \
name=&quot;activated&quot;)</div><div>            def activated(reason):</div><div>   \
print(reason)</div><div><br></div><div>             \
tray.activated.connect(activated)</div><div><br></div><div>The error I get: \
TypeError: C++ type &#39;QPlatformSystemTrayIcon::ActivationReason&#39; is not \
supported as a signal argument type</div><div><br></div><div>What would be the \
correct way to do this?</div><div><br></div><div>Also I&#39;m not entirely sure if \
this is PyQt related but the reason I&#39;m trying to do it this way (and not in my \
QtQuick QML file) is because `onActivated: { console.log(reason); }` always prints \
undefined in the app.qml (but im not sure if it&#39;s a Qt or PyQt \
issue)</div><div><br></div></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic