JavaVM - platformNativeInterface - Qt5

415 views
Skip to first unread message

Christophe M

unread,
May 13, 2013, 9:51:33 AM5/13/13
to andro...@googlegroups.com
I'm using Qt5 for android to build a qml application without problems but to be able to call a java method from Qt, I try to get a pointer to the JavaVM and I have this error :

JavaVM* currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);

error: invalid use of incomplete type 'class QPlatformNativeInterface'

Without this, application run fine on device.

Any idea ? How can I call a java method from Qt ?

Matti Dahlbom

unread,
May 13, 2013, 11:04:44 AM5/13/13
to andro...@googlegroups.com


On Mon, 13 May 2013, Christophe M wrote:

> error: invalid use of incomplete type 'class QPlatformNativeInterface'

#include <QPlatformNativeInterface>

?

- M

Christophe M

unread,
May 13, 2013, 11:08:12 AM5/13/13
to andro...@googlegroups.com
error: QPlatformNativeInterface: No such file or directory

The call comes from QApplication (QApplication::platformNativeInterface())


2013/5/13 Matti Dahlbom <ma...@777-team.org>
#include <QPlatformNativeInterface>


Marc

unread,
May 13, 2013, 2:19:47 PM5/13/13
to andro...@googlegroups.com
QPlatformNativeInterface is a private header.
so you need to include the path to the private headers.

Christophe M

unread,
May 14, 2013, 3:54:39 AM5/14/13
to andro...@googlegroups.com
Seems that the qplatformnativeinterface header has changed in Qt 5.1, it doesn't contains nativeRessourceForWidget ..
Is there an other way than implementing a socket communication between Java and Qt to communicate from Qt to Java ?



#include "QtGui/5.1.0/QtGui/qpa/qplatformnativeinterface.h"


error: 'class QPlatformNativeInterface' has no member named 'nativeResourceForWidget'

Marc

unread,
May 14, 2013, 12:18:18 PM5/14/13
to andro...@googlegroups.com
Am 14.05.2013 09:54, schrieb Christophe M:
Seems that the qplatformnativeinterface header has changed in Qt 5.1, it doesn't contains nativeRessourceForWidget ..


Is there an other way than implementing a socket communication between Java and Qt to communicate from Qt to Java ?


#include "QtGui/5.1.0/QtGui/qpa/qplatformnativeinterface.h"

error: 'class QPlatformNativeInterface' has no member named 'nativeResourceForWidget'





yeah, it changed.

qApp->platformNativeInterface()->nativeResourceForIntegration("JavaVM")

that's what you want to call. the rest is still the same, i think.
Reply all
Reply to author
Forward
0 new messages