Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. What is the corresponding dbus type for `uint32` and `Vardict` in Qt?
Forum Updated to NodeBB v4.3 + New Features

What is the corresponding dbus type for `uint32` and `Vardict` in Qt?

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 170 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jarusll
    wrote on last edited by jarusll
    #1

    I am not able to connect to a Response signal for Dbus
    result = connection.connect(desktopObjPath, requestObjPath, requestInterface, "Response", self, SLOT("screenshotUri(uint32, QVariantMap)"))

    confirmed by the return value of result being False.

    I believe it might be due to the type mismatch between the slot binding screenshotUri(uint32, QVariantMap)
    and the slot definition

    @Slot(int, dict)
        def screenshotUri(self, integer, dictionary):
    
    1. How can I know the root cause of the issue?
    2. If it is the slot signature? What are the corresponding types for Response(uint32, vardict)
    from PySide6.QtGui import QGuiApplication, QClipboard
    from PySide6.QtCore import QObject, Property, Signal, Slot, SLOT
    from PySide6.QtQml import QQmlApplicationEngine, QmlElement
    from PySide6.QtDBus import QDBusInterface, QDBusConnection, QDBusMessage, QDBusReply, QDBusObjectPath
    import sys
    import requests
    
    connection = QDBusConnection.sessionBus()
    
    portalService = "org.freedesktop.portal.Desktop"
    desktopObjPath = "/org/freedesktop/portal/desktop"
    openURIInterface = "org.freedesktop.portal.OpenURI"
    screenShotInterface = "org.freedesktop.portal.Screenshot"
    requestInterface = "org.freedesktop.portal.Request"
    dbusInterface = QDBusInterface(portalService, desktopObjPath, screenShotInterface, connection)
    
    method = "Screenshot"
    QML_IMPORT_NAME = "com.jarusll.Popup"
    QML_IMPORT_MAJOR_VERSION = 1
    
    @QmlElement
    class Popup(QObject):
        inputChanged = Signal(str)
        visibleChanged = Signal(bool)
    
        def __init__(self, parent=None):
            super().__init__(parent)
            self._context = ""
            self._prompt = ""
            self._loading = False
            self._visible = True
    
            vars = {
                "handle_token": "handle_token",
                "interactive": True
            }
            dbusInterface.callWithCallback(method, ["parent_window", vars], self, SLOT("handleScreenshot(QDBusObjectPath)"))
    
        @Slot(QDBusObjectPath)
        def handleScreenshot(self, reply):
            print(reply)
            requestObjPath = reply.path()
            result = connection.connect(desktopObjPath, requestObjPath, requestInterface, "Response", self, SLOT("screenshotUri(uint32, QVariantMap)"))
            print("Result", result)
    
        @Slot(int, dict)
        def screenshotUri(self, integer, dictionary):
            print("Response: ", integer, dictionary)
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved