Pass QIcon over D-Bus
Florian Bruhin
me at the-compiler.org
Wed Jun 15 15:36:25 BST 2022
Hey,
On Wed, Jun 15, 2022 at 04:12:13PM +0200, JakobDev wrote:
> There is a working C++ implementation but I couldn't get it to work in
> Python.
Qt DBus is still a lot of black magic to me, but I noticed that you do:
QIcon.fromTheme("utilities-terminal").pixmap(512, 512).save(buffer, "PNG")
[...]
message.setArguments(["", "Name", QDBusVariant(buffer), {}])
while the C++ code does:
QIcon::fromTheme("utilities-terminal").pixmap(maxSize, maxSize).save(&buffer,"PNG");
PortalIcon icon {QStringLiteral("bytes"), QDBusVariant(buffer.buffer())};
message << parentWindowId() << QStringLiteral("Patschen")
<< QVariant::fromValue(QDBusVariant(QVariant::fromValue(icon)))
<< ...
You seem to be missing the second step there: creating a PortalIcon
object with the "bytes" string in it, and the actual data from the
QBuffer (as a QByteArray).
I don't know how far it'll get you, but I do something vaguely similar
here:
https://github.com/qutebrowser/qutebrowser/blob/v2.5.1/qutebrowser/browser/webengine/notification.py#L1047-L1048
The data is then added here:
https://github.com/qutebrowser/qutebrowser/blob/v2.5.1/qutebrowser/browser/webengine/notification.py#L1096
Florian
--
me at the-compiler.org | https://www.qutebrowser.org
https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220615/8241139c/attachment.sig>
More information about the PyQt
mailing list