Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. registered class QHostAddress wrapped in QVariant?
QtWS25 Last Chance

registered class QHostAddress wrapped in QVariant?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 511 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.
  • 6thC6 Offline
    6thC6 Offline
    6thC
    wrote on last edited by
    #1

    How do I unwrap the QVariant from QHostAddress?

    I register with:

    qRegisterMetaType<QHostAddress>("QHostAddress");
    

    I wish to intercept a c++ signal

    void readyData(const qint64 &msSinceEpoch, const QByteArray &data, const QHostAddress &address, const quint16 port);
    

    and slot to QML:

    Connections { target:  ReceiverCpp;
       onReadyData: networkDiagWindow.readyDataMessage(msSinceEpoch, data, address.toString(), port);
    

    qml Window object networkDiagWindow has:

    function  readyDataMessage(msSinceEpoch, data, address, port){ 
                print (msSinceEpoch, data.toString(), address , port);
    

    Which outputs everything as string or numbers correctly except for address it ouputs exactly:
    QVariant(QHostAddress)

    How do I unrawp this QVariant and get at just my object? I've looked for a QML HostAddress but doesn't seem to exist.

    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