[Interest] QQmlEngine: Illegal attempt to connect to PlatformShim(0xb9b2fb58) that is in a different thread than the QML engine QQmlApplicationEngine(0xa17e1494.

Jason H jhihn at gmx.com
Thu Dec 1 23:46:27 CET 2016


Still having issues... But made some "progress"
So I changed to using qmlRegisterSingletonType<PlatformShim>("PlatformSupport", 1, 0 "PlatformShim", &getPlatformShim)
However when I do I get 1 of 2 errors:
1. Element is not creatable:  when trying to declare a signal handler like PlatformShim { onPushNotificationReceived; {} }
2. Non-existent attached object: when trying to declare a signal handler (in QML) PlatformShim.onPushTokenReceived: { }

I also added:
QObject *getPlatformShim(QQmlEngine *engine, QJSEngine *scriptEngine)
{
	Q_UNUSED(engine)
	Q_UNUSED(scriptEngine)

	return PlatformShim::instance();
}

and 
import PlatformSupport 1.0 to the QML 

> Sent: Thursday, December 01, 2016 at 4:45 PM
> From: "Jason H" <jhihn at gmx.com>
> To: "Qt Interest" <interest at qt-project.org>
> Subject: [Interest] QQmlEngine: Illegal attempt to connect to PlatformShim(0xb9b2fb58) that is in a different thread than the QML engine QQmlApplicationEngine(0xa17e1494.
>
> I get that error when:
> main.cpp:
> PlatformShim *shim = PlatformShim::instance();
> engine.rootContext()->setContextProperty(QStringLiteral("platformShim"), shim);
> 
> In a QML file:
> Connections {
> 	target: platformShim
> 	onPushTokenReceived: {
> 		pushToken = token
> 	}
> }
> 
> I thought Connections were ok across threads?
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 



More information about the Interest mailing list