mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-07 07:20:14 +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) {
|
void QmlWindowClass::qmlToScript(const QVariant& message) {
|
||||||
QJSValue js = qvariant_cast<QJSValue>(message);
|
if (message.canConvert<QJSValue>()) {
|
||||||
emit fromQml(js.toVariant());
|
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) {
|
void QmlWindowClass::sendToQml(const QVariant& message) {
|
||||||
|
|
Loading…
Reference in a new issue