summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-02-24 14:18:04 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2011-02-24 14:18:04 +0100
commit55911b95fe4f5de8d2359847696f5f5bd0a8f00d (patch)
treea29934a465be069ef11794f1a8da6e514c607fda
parent8722951e354aa80bf5da9f42e6192522210d491f (diff)
Workaround for setEnabled calls from scripts.QtSDK-1.1.01.1betasimulator-1.1
Reviewed-by: owolff
-rw-r--r--library/components/locationui.cpp17
-rw-r--r--library/components/locationui.h2
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;