Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Accessing signal of QGeoCoordinate from QML



  • Hello,

    i have a class which reads via QTcpSocket the GPSD socket stream and decodes the json values to QGeoPositionInfo whenever a valid position is available. It then emits the QGeoPositionInfo signal:

    // ---- Content of readyRead()
    // ...
    QGeoPositionInfo pos;
    pos.setCoordinate(QGeoCoordinate(obj["lat"].toDouble(), obj["lon"].toDouble(), obj["alt"].toDouble()));
    emit positionUpdate(pos);
    

    But i'm a bit clueless how to access QGeoPositionInfo in the QML part:

    Backend {
        id: backend
    
        onGpsPositionUpdate: {
            gpsPosition.text = pos.coordinate.latitude // <-- Doesn't work
        }
    }
    

    I appreciate any help, thanks.

    Best regards,
    Kevin


Log in to reply