Skip to content

Commit

Permalink
Python support: addressed an issue with running a DAE model without a…
Browse files Browse the repository at this point in the history
… GUI (e.g. using a Python script) on Windows (#2178).

See #2178 (comment).
  • Loading branch information
agarny committed Dec 12, 2019
1 parent e53c963 commit 6c7100f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/plugins/solverinterface.cpp
Expand Up @@ -145,19 +145,20 @@ NlaSolver * nlaSolver(const QString &pObjectAddress)
// Return the runtime's NLA solver

QObject *object = reinterpret_cast<NlaSolver *>(QVariant(pObjectAddress).toULongLong());
QVariant res = object->property(pObjectAddress.toUtf8().constData());

return res.isValid()?reinterpret_cast<NlaSolver *>(res.toULongLong()):nullptr;
return reinterpret_cast<NlaSolver *>(QVariant(object->objectName()).toULongLong());
}

//==============================================================================

void setNlaSolver(QObject *pObject, NlaSolver *pNlaSolver)
{
// Keep track of the runtime's NLA solver
// Note: normally, we would use QObject::setProperty(), but it doesn't play
// well on Windows without a GUI (see https://bit.ly/2YCpzew). So,
// instead, we use QObject::setObjectName() (!!)...

pObject->setProperty(objectAddress(pObject).toUtf8().constData(),
quint64(pNlaSolver));
pObject->setObjectName(objectAddress(pNlaSolver));
}

//==============================================================================
Expand Down

0 comments on commit 6c7100f

Please sign in to comment.