mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 01:04:06 +02:00
Fix passing of simple string message types from QML to scripts
This commit is contained in:
parent
5a665f9aef
commit
ca67c7335f
1 changed files with 7 additions and 2 deletions
|
@ -130,8 +130,13 @@ void QmlWindowClass::initQml(QVariantMap properties) {
|
|||
}
|
||||
|
||||
void QmlWindowClass::qmlToScript(const QVariant& message) {
|
||||
QJSValue js = qvariant_cast<QJSValue>(message);
|
||||
emit fromQml(js.toVariant());
|
||||
if (message.canConvert<QJSValue>()) {
|
||||
emit fromQml(qvariant_cast<QJSValue>(message).toVariant());
|
||||
} else if (message.canConvert<QString>()) {
|
||||
emit fromQml(message.toString());
|
||||
} else {
|
||||
qWarning() << "Unsupported message type " << message;
|
||||
}
|
||||
}
|
||||
|
||||
void QmlWindowClass::sendToQml(const QVariant& message) {
|
||||
|
|
Loading…
Reference in a new issue