[Interest] qt6: any QtAndroid::androidActivity replacement?

Alexander Dyagilev alervdvcw at gmail.com
Sat Sep 18 15:37:10 CEST 2021


So, I've managed to find a right one:

auto meow = app.nativeInterface<QNativeInterface::QAndroidApplication>();
meow->context();


On 9/18/2021 4:11 PM, Alexander Dyagilev wrote:
>
> This does not work too:
>
> QCoreApplication::instance()->nativeInterface()->context();
>
> C:\Users\alexa\Documents\Qt Creator\untitled3\main.cpp:14: error: no 
> matching member function for call to 'nativeInterface'
> ..\untitled3\main.cpp:14:35: error: no matching member function for 
> call to 'nativeInterface'
> QCoreApplication::instance()->nativeInterface()->context();
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> D:\Qt\6.2.0\android_armv7\include\QtCore/qcoreapplication.h:167:5: 
> note: candidate template ignored: couldn't infer template argument 
> 'NativeInterface'
>     QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QCoreApplication)
>     ^
> D:\Qt\6.2.0\android_armv7\include\QtCore/qnativeinterface.h:176:22: 
> note: expanded from macro 'QT_DECLARE_NATIVE_INTERFACE_ACCESSOR'
>     NativeInterface *nativeInterface() const \
>                      ^
>
>
> On 9/18/2021 4:08 PM, Alexander Dyagilev wrote:
>>
>> I've also found this: 
>> https://doc-snapshots.qt.io/qt6-dev/qnativeinterface-qandroidapplication.html#details
>>
>> It says it can be accessed through QCoreApplication::nativeInterface().
>>
>> I've tried: QCoreApplication::nativeInterface()->context(). It does 
>> not compile: mysterious error : call to non-static member function 
>> without an object argument
>> ..\untitled3\main.cpp:14:23: error: call to non-static member 
>> function without an object argument
>>     QCoreApplication::nativeInterface()->context();
>>     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
>>
>> Again, no documentation can be find anywhere about this native 
>> interface....
>>
>>
>> On 9/18/2021 3:55 PM, Alexander Dyagilev wrote:
>>> I did find this (using Google): 
>>> https://doc-snapshots.qt.io/qt6-dev/qtandroidprivate.html
>>>
>>> But I can't use it: #include <QtAndroid> does not work - it says: 
>>> fatal error: 'QtAndroid' file not found. Qt 6.2 RC...
>>>
>>> On 9/18/2021 3:53 PM, Alexander Dyagilev wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm trying to port my Android application from Qt5 to Qt6. 
>>>> Documentation seems to be very poorly organized. I can't find 
>>>> anywhere a section about new Qt Android classes.
>>>>
>>>> Can someone please give me the link (if any)?
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210918/5772a925/attachment.html>


More information about the Interest mailing list