diff options
-rw-r--r-- | library/components/locationui.cpp | 17 | ||||
-rw-r--r-- | library/components/locationui.h | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/library/components/locationui.cpp b/library/components/locationui.cpp index 37c4c91..1d55f5a 100644 --- a/library/components/locationui.cpp +++ b/library/components/locationui.cpp @@ -300,10 +300,11 @@ void LocationUi::emitSatelliteDataChange() const void LocationUi::showSatelliteInfo() { bool editingEnabled = satellitePrns->count() != 0; - satelliteAzimuth->setEnabled(editingEnabled); - satelliteElevation->setEnabled(editingEnabled); - satelliteSignalStrength->setEnabled(editingEnabled); - satelliteInUse->setEnabled(editingEnabled); + + // workaround for calling this from another thread (scripts): + // always perform the setEnabled calls in the gui thread - + // setEnabled calls sendEvent! + QMetaObject::invokeMethod(this, "enableSateliteControls", Qt::QueuedConnection, Q_ARG(bool, editingEnabled)); if (!editingEnabled) return; @@ -710,3 +711,11 @@ bool LocationScriptInterface::setInUse(int prn, bool inUse) } return false; } + +void LocationUi::enableSateliteControls(bool enabled) +{ + satelliteAzimuth->setEnabled(enabled); + satelliteElevation->setEnabled(enabled); + satelliteSignalStrength->setEnabled(enabled); + satelliteInUse->setEnabled(enabled); +} diff --git a/library/components/locationui.h b/library/components/locationui.h index 3e3dc3e..984f0e4 100644 --- a/library/components/locationui.h +++ b/library/components/locationui.h @@ -115,6 +115,8 @@ private slots: void removeSatelliteClicked(); private: + Q_INVOKABLE void enableSateliteControls(bool enabled); + QLineEdit *mLatitudeEdit; QLineEdit *mLongitudeEdit; QLineEdit *mAltitudeEdit; |