summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Nafees <[email protected]>2017-04-24 06:33:22 -0400
committerMohammed Nafees <[email protected]>2017-04-24 06:33:22 -0400
commit065932841c37aeff7b6905a06f58d9d7ee68ad43 (patch)
treef7b192df9d4093be841c1b960069017315b469a7
parentb3a589369b0156917ebc5038f81b5f97b60c6f3c (diff)
Fix crash on macOS on subsequent runs after first run.
The position of FloatItems were stored as invalid strings in the .plist file which resulted in a crash from the second run onwards.
-rw-r--r--src/lib/marble/AbstractFloatItem.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/marble/AbstractFloatItem.cpp b/src/lib/marble/AbstractFloatItem.cpp
index b3003a0..49ba5b6 100644
--- a/src/lib/marble/AbstractFloatItem.cpp
+++ b/src/lib/marble/AbstractFloatItem.cpp
@@ -73,16 +73,24 @@ AbstractFloatItem::~AbstractFloatItem()
QHash<QString,QVariant> AbstractFloatItem::settings() const
{
QHash<QString,QVariant> updated = RenderPlugin::settings();
+#ifdef Q_OS_OSX
+ updated.insert(QStringLiteral("position"), position().toPoint());
+#else
updated.insert(QStringLiteral("position"), position());
+#endif
return updated;
}
void AbstractFloatItem::setSettings(const QHash<QString, QVariant> &settings)
{
if (settings.value(QStringLiteral("position")).type() == QVariant::String) {
+#ifdef Q_OS_OSX
+ setPosition(settings.value(QStringLiteral("position"), position()).toPointF());
+#else
// work around KConfig turning QPointFs into QStrings
const QStringList coordinates = settings.value(QStringLiteral("position")).toString().split(QLatin1Char(','));
setPosition( QPointF( coordinates.at( 0 ).toFloat(), coordinates.at( 1 ).toFloat() ) );
+#endif
}
else {
setPosition(settings.value(QStringLiteral("position"), position()).toPointF());