mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-23 03:06:34 +00:00
Register MAVSDK::Telemetry::Position type for Qt
Without this application can't get position events in Qt5 based systems. Type: Improvement
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
QT = core
|
QT = core
|
||||||
CONFIG += c++17 cmdline
|
CONFIG += cmdline
|
||||||
|
|
||||||
# Reduce compiler warnings from the ArduPilot headers
|
# Reduce compiler warnings from the ArduPilot headers
|
||||||
QMAKE_CXXFLAGS += -Wno-address-of-packed-member
|
QMAKE_CXXFLAGS += -Wno-address-of-packed-member -std=gnu++1z
|
||||||
|
|
||||||
# MAVSDK pkg-config file is garbage. Add dependency manually
|
# MAVSDK pkg-config file is garbage. Add dependency manually
|
||||||
QMAKE_RPATHDIR += /usr/local/lib
|
QMAKE_RPATHDIR += /usr/local/lib
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QMetaProperty>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ bool AzDroneController::stateTelemetryModule(void)
|
|||||||
|
|
||||||
// Subscripe to position updates. Updated comes from different MAVSDK thread. Send position
|
// Subscripe to position updates. Updated comes from different MAVSDK thread. Send position
|
||||||
// as signal to this class (Qt::QueuedConnection) so that it's handled in the main thread.
|
// as signal to this class (Qt::QueuedConnection) so that it's handled in the main thread.
|
||||||
|
qRegisterMetaType<Telemetry::Position>("Telemetry::Position");
|
||||||
connect(this, &AzDroneController::newPosition, this, &AzDroneController::newPositionSlot, Qt::QueuedConnection);
|
connect(this, &AzDroneController::newPosition, this, &AzDroneController::newPositionSlot, Qt::QueuedConnection);
|
||||||
mTelemetry->subscribe_position([this](Telemetry::Position position) { emit newPosition(position); });
|
mTelemetry->subscribe_position([this](Telemetry::Position position) { emit newPosition(position); });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user