Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QRemoteObject with QDomDocument
Forum Update on Monday, May 27th 2025

QRemoteObject with QDomDocument

Scheduled Pinned Locked Moved Solved 3rd Party Software
qtro
2 Posts 1 Posters 975 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.
  • M Offline
    M Offline
    Marek
    wrote on last edited by A Former User
    #1

    Hi all,

    Can I use QDomDocument signal/slot in REPC generated replicas ?
    It's question about QtRO

    I have tested QtRemoteObject with simple example, but as soon as I add QDomDocument to .rep file I get error:

    /Qt/5.7/android_armv7/include/QtCore/qmetatype.h: In instantiation of 'constexpr int qMetaTypeId() [with T = QDomDocument]':
    /Qt/5.7/android_armv7/include/QtCore/qmetatype.h:1752:27:   required from 'constexpr int qRegisterMetaType() [with T = QDomDocument]'
    rep_pingpong_replica.h:32:41:   required from here
    /Qt/5.7/android_armv7/include/QtCore/qglobal.h:746:47: error: static assertion failed: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system
    

    .rep file

    #include <QDomDocument>
    
    class PingPong {
        SLOT(void ping(QString msg));
        SLOT(void pingXml(QDomDocument xml));
        SIGNAL(pong(QString msg));
    }
    
    

    .rep file will not permit Q_DECLARE_METATYPE
    In my app I'm just using
    qRegisterMetaType<QDomDocument>("QDomDocument");
    for signal/slot, but I don't know how to do it with QtRemoteObject ?

    Best Regards
    Marek

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Marek
      wrote on last edited by
      #2

      Hi

      I have made it to work.
      After rep files are generated with compile error, edit them and paste QDataStream definition before class body. Ifndef is necessary if you have more than one class for remoting with QDomDocument in signal/slot

      #ifndef _xml_operator_
      #define _xml_operator_
      Q_DECLARE_METATYPE(QDomDocument)
      inline QDataStream& operator<<(QDataStream& out, QDomDocument xml)
      {
      out << xml.toString();
      return out;
      }
      inline QDataStream& operator>>(QDataStream& in, QDomDocument& xml)
      {
          QString msg;
          in >> msg;
          xml.setContent(msg);
      return in;
      }
      #endif //_xml_operator_
      

      hope it will help somebody

      Best Regards
      Marek

      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