Commit 06593284 authored by Mohammed Nafees's avatar Mohammed Nafees

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.
parent b3a58936
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment