Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. sending QHostAddress over Qt Dbus
Qt 6.11 is out! See what's new in the release blog

sending QHostAddress over Qt Dbus

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 738 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.
  • V Offline
    V Offline
    Venkateswaran
    wrote on last edited by
    #1

    I tried to send QHostAddress over Qt Dbus but getting below error.

    /aarch64-buildroot-linux-gnu/sysroot/usr/include/qt5/QtDBus/qdbusmetatype.h:68: error: no match for ‘operator<<’ (operand types are ‘QDBusArgument’ and ‘const QHostAddress’)
    /aarch64-buildroot-linux-gnu/sysroot/usr/include/qt5/QtDBus/qdbusmetatype.h: In instantiation of ‘void qDBusMarshallHelper(QDBusArgument&, const T*) [with T = QHostAddress]’:
    /aarch64-buildroot-linux-gnu/sysroot/usr/include/qt5/QtDBus/qdbusmetatype.h:81:12:   required from ‘int qDBusRegisterMetaType(T*) [with T = QHostAddress]’
    

    but I have provided marshal and unmarshal functions for it.

    QDBusArgument& operator<<(QDBusArgument& argument,
                                          const QHostAddress& ip) {
      argument.beginStructure();
      argument << ip.toString();
      argument.endStructure();
      return argument;
    }
    
    const QDBusArgument& operator>>(const QDBusArgument& argument,
                                                QHostAddress& ip) {
      QString nmosIp;
      argument.beginStructure();
      argument >> nmosIp;
      argument.endStructure();
      ip = QHostAddress{nmosIp};
      return argument;
    }
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      Did you also call qDBusRegisterMetaType<>() - it's needed according to the docs.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      V 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Did you also call qDBusRegisterMetaType<>() - it's needed according to the docs.

        V Offline
        V Offline
        Venkateswaran
        wrote on last edited by
        #3

        @Christian-Ehrlicher yes, that's where this error comes, because qDBusRegisterMetaType<>() calls << & >> functions

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          And are your calls visible to the compiler where you call qDBusRegisterMetaType? Please show the complete code - best in a simple main.cpp

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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